none
Compiler error in vs on mysql_connection.h file

    Question

  • Dear VS experts out there:

    I have been trying to use the source code of mysql_connection.h with in a .cpp program.   Including the directory via

    property and c++ general -additional Include directory, has worked.    But the compiler produces error message on almost every line of the file.   Please see the diagnostics as submitted below.   Something in front of each code line causes this problem.

    I removed during the copy of the file all the prefix of line numbers.   When the test is done in a .cpp program, it hangs up.

    Your guide be much appreciated!   Thanking you in advance!

    Source code from mysql on mysql_connection.h

     

    19 

    20     //MySQL DB access module, for use by plugins and others

    21     //For the module that implements interactive DB functionality see mod_db

      

    22

    23   

    24     #ifndef _MOD_MYSQL_CONNECTION_H_

    25     #define _MOD_MYSQL_CONNECTION_H_

    26

    27        #include "shellcore/types.h"

    28        #include "shellcore/types_cpp.h"

    29        #include "utils/utils_time.h"

     

    #if WIN32

    #  include <winsock2.h>

    #endif

     

     

        

        #include <mysql.h>

        #include "mod_common.h"

     

    C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(19): error C3873: '0xa0': this character is not allowed as a first character of an identifier

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(20): error C3873: '0xa0': this character is not allowed as a first character of an identifier

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(21): error C3873: '0xa0': this character is not allowed as a first character of an identifier

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(21): error C2146: syntax error: missing ';' before identifier ' '

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(22): error C3873: '0xa0': this character is not allowed as a first character of an identifier

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(23): error C3873: '0xa0': this character is not allowed as a first character of an identifier

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(23): error C2014: preprocessor command must start as first nonwhite space

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(24): error C3873: '0xa0': this character is not allowed as a first character of an identifier

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(24): error C2014: preprocessor command must start as first nonwhite space

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(25): error C3873: '0xa0': this character is not allowed as a first character of an identifier

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(26): error C3873: '0xa0': this character is not allowed as a first character of an identifier

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(26): error C2014: preprocessor command must start as first nonwhite space

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(27): error C3873: '0xa0': this character is not allowed as a first character of an identifier

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(27): error C2014: preprocessor command must start as first nonwhite space

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(28): error C3873: '0xa0': this character is not allowed as a first character of an identifier

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(28): error C2014: preprocessor command must start as first nonwhite space

    1>C:\Users\ChanB\Documents\Programming\Common Code\mysql_connection.h(29): error C3873: '0xa0': this character is not allowed as a first character of an identifier


    cbo

    Tuesday, January 17, 2017 4:39 PM

Answers

  • You probably copied the file from some Web, Word or PDF source, including the special non-breaking spaces (having the A0 code).

    Try finding a good variant of the file. Or try replacing A0 with simple spaces. This can be done in Visual Studio: open the file, then show Quick Replace (Ctrl+H), enter \xA0 in Search Term field, a space in Replacement field, select the Use Regular Expressions mode, then press Replace All.


    • Edited by Viorel_MVP Tuesday, January 17, 2017 5:50 PM
    • Marked as answer by poosung Tuesday, January 17, 2017 10:59 PM
    Tuesday, January 17, 2017 5:50 PM

All replies

  • You probably copied the file from some Web, Word or PDF source, including the special non-breaking spaces (having the A0 code).

    Try finding a good variant of the file. Or try replacing A0 with simple spaces. This can be done in Visual Studio: open the file, then show Quick Replace (Ctrl+H), enter \xA0 in Search Term field, a space in Replacement field, select the Use Regular Expressions mode, then press Replace All.


    • Edited by Viorel_MVP Tuesday, January 17, 2017 5:50 PM
    • Marked as answer by poosung Tuesday, January 17, 2017 10:59 PM
    Tuesday, January 17, 2017 5:50 PM
  • Hi, Viorel,

    So nice of you to help me during the working hours.

    I tried your guide, searching for \xA0, xA0, A0 in the search term.

    Then, chose " " once or just moving space bar a couple times in the replacement field.

    Use regular expression and then, clicking on replace all.   The result:

    \xA0 not found.

    I may be doing something wrong.  Thanks for your guide again.


    cbo

    Tuesday, January 17, 2017 6:28 PM
  • Dear Viorel,

    your guide worked for the invisible vertical line removal, which was between line numbers and the code line.   Then, through Windows Edge, I found out that "\d+" as search code worked to remove the row numbers.  

    I thank you once again.

    CBO


    cbo

    Tuesday, January 17, 2017 11:02 PM