C++ (Qt)#include <stdio.h> #include <mysql.h> MYSQL* conn; void main() { conn=mysql_init(NULL); mysql_real_connect(conn, "localhost", "root", "root", "mysql", 0, NULL, 0); mysql_close(conn); }
1>------ Build started: Project: mysqltest, Configuration: Debug Win32 ------1>Compiling...1>main.cpp1>c:\program files\microsoft visual studio 9.0\vc\include\mysql_com.h(243) : error C2146: syntax error : missing ';' before identifier 'fd'1>c:\program files\microsoft visual studio 9.0\vc\include\mysql_com.h(243) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>c:\program files\microsoft visual studio 9.0\vc\include\mysql_com.h(243) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>c:\program files\microsoft visual studio 9.0\vc\include\mysql_com.h(417) : error C2065: 'SOCKET' : undeclared identifier1>c:\program files\microsoft visual studio 9.0\vc\include\mysql_com.h(417) : error C2146: syntax error : missing ')' before identifier 's'1>c:\program files\microsoft visual studio 9.0\vc\include\mysql_com.h(418) : error C2059: syntax error : ')'1>Build log was saved at "file://c:\prjmysql\mysqltest\mysqltest\Debug\BuildLog.htm"1>mysqltest - 6 error(s), 0 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
C#ifndef my_socket_defined#ifdef __WIN__#define my_socket SOCKET#elsetypedef int my_socket;#endif /* __WIN__ */#endif /* my_socket_defined */#endif /* _global_h */
C++ (Qt)#include <windows.h>#include <winsock.h>
C++ (Qt)#include <mysql.h>
C++ (Qt)#include <windows.h>#include <winsock.h>#include <mysql.h> MYSQL* conn; void main() { conn=mysql_init(NULL); mysql_real_connect(conn, "localhost", "root", "root", "mysql", 0, NULL, 0); mysql_close(conn); }
>main.obj : error LNK2019: unresolved external symbol _mysql_close@4 referenced in function _main1>main.obj : error LNK2019: unresolved external symbol _mysql_real_connect@32 referenced in function _main1>main.obj : error LNK2019: unresolved external symbol _mysql_init@4 referenced in function _main1>C:\prjmysql\mysqltest\Debug\mysqltest.exe : fatal error LNK1120: 3 unresolved externals