C+++ (g++) , Codelite, Ubuntu, Mysql - all together :



  • The challenge is to write some code that will do something about Mysql's OBD. Complicity in the formation of options for g+++.

    At this point, the options are:

    g++ -I/usr/include/mysql++ -I/usr/include/mysql
    

    The paths are right, but it's okay to collect the project.

    ----------Build Started-------- /bin/sh -c '"make" -j 2 -f "MHC_wsp.mk"' ----------Building project:[ Myhobby - Debug ]---------- make[1]: Вход в каталог '/home/kost/.codelite/MHC' g++ -c "/home/kost/.codelite/MHC/main.cpp" -g -I/usr/include/mysql++ -I/usr/include/mysql -o ./Debug/main.o "-I." "-I." /home/kost/.codelite/MHC/main.cpp:1:19: warning: extra tokens at end of #include directive /home/kost/.codelite/MHC/main.cpp:2:19: warning: extra tokens at end of #include directive /home/kost/.codelite/MHC/main.cpp:3:20: warning: extra tokens at end of #include directive /home/kost/.codelite/MHC/main.cpp: In function ‘int main()’: /home/kost/.codelite/MHC/main.cpp:63:19: warning: deprecated conversion from string constant to ‘char*’ /home/kost/.codelite/MHC/main.cpp:64:17: warning: deprecated conversion from string constant to ‘char*’ /home/kost/.codelite/MHC/main.cpp:65:21: warning: deprecated conversion from string constant to ‘char*’ /home/kost/.codelite/MHC/main.cpp:66:21: warning: deprecated conversion from string constant to ‘char*’ /home/kost/.codelite/MHC/main.cpp:72:56: warning: deprecated conversion from string constant to ‘char*’ g++ -o ./Debug/Myhobby ./Debug/main.o "-L." ./Debug/main.o: In function 'mysql_connection_setup(connection_details)': /home/kost/.codelite/MHC/main.cpp:24: undefined reference to 'mysql_init' /home/kost/.codelite/MHC/main.cpp:27: undefined reference to 'mysql_real_connect' /home/kost/.codelite/MHC/main.cpp:28: undefined reference to 'mysql_error' ./Debug/main.o: In function 'mysql_perform_query(st_mysql*, char*)': /home/kost/.codelite/MHC/main.cpp:41: undefined reference to 'mysql_query' /home/kost/.codelite/MHC/main.cpp:43: undefined reference to 'mysql_error' /home/kost/.codelite/MHC/main.cpp:47: undefined reference to 'mysql_use_result' ./Debug/main.o: In function 'main': /home/kost/.codelite/MHC/main.cpp:79: undefined reference to 'mysql_fetch_row' /home/kost/.codelite/MHC/main.cpp:83: undefined reference to 'mysql_free_result' /home/kost/.codelite/MHC/main.cpp:85: undefined reference to 'mysql_close' collect2: ld returned 1 exit status make[1]: *** [Debug/Myhobby] Ошибка 1 make[1]: Выход из каталога '/home/kost/.codelite/MHC' make: *** [All] Ошибка 2 ----------Build Ended---------- 9 errors, 8 warnings

    I don't know why yet.

    P.S. Rights /usr/include/mysql (mysql++) = 777
    P.P.S. - The problem is, in fact, that the compiler sees no reference to the necessary facilities:



  • The thing is, heders (*.h) only have job announcements, that is, their interface. The code for these functions is compiled in the library. Therefore, the libmysql+++ Library, which defines missing symbols, should be added in the blink. The line in the blade would look like,

    g++ -o ./Debug/Myhobby ./Debug/main.o -lmysqlpp
    

    This means that the compiler should locate the dynamic library libmysqlpp.so, which is located either in one of the directors of the clearly indicated (-L[name of directory]) or in the default system directory with the designated libraries (usually /usr/lib).

    PS: There's no need to clearly indicate the O.I./usr/include/... The compiler is searching for the place where the designated libraries keep their heds (usr/include). Programmes include the following:

    #include <mysql++/query.h>
    

    PPS: You should not have a right to change that directory in /usr/include/mysql++ right 777.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2