How to include the mysql header?

后端 未结 5 1085
失恋的感觉
失恋的感觉 2020-12-06 19:43

I\'m building an open source project from source,

and it needs to include :

#if USE_MYSQL
#include 
#endif         


        
5条回答
  •  感动是毒
    2020-12-06 20:03

    #include  "path-spec"
    #include  
    

    Both syntax forms cause replacement of that directive by the entire contents of the specified include file. The difference between the two forms is the order in which the preprocessor searches for header files when the path is incompletely specified.

    #include "path-spec" instructs the preprocessor to look for include files in the same directory of the file that contains the #include statement, and then in the directories of any files that include (#include) that file. The preprocessor then searches along the path specified by the /I compiler option, then along paths specified by the INCLUDE environment variable.

    #include instructs the preprocessor to search for include files first along the path specified by the /I compiler option, then, when compiling from the command line, along the path specified by the INCLUDE environment variable.

    I don't know what compiler you are using, but it may require you to add your includes and libs to the compilation:

    g++ bla.cpp -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient_r
    

提交回复
热议问题