Put libmysql. dll in the same place as the execution file exe. mysql's include and lib are all modified in the project properties, but nothing is output after the program is executed ???? Win32 console program: & quot; # include & quot; stdafx. h & quot; # include define socket # include & quot; mysql. h & quot; # pragmacomment (lib, & quot; libmysql. lib & quot;) and add mysql to the additional dependency. li mysql console
Put libmysql. dll in the same place as the execution file exe. mysql's include and lib are all modified in the project properties, but nothing is output after the program is executed ????
Win32 console program:
# Include "stdafx. h" # include
// Define socket # include
# Include "mysql. h "# pragma comment (lib," libmysql. lib ") // this sentence and add mysql to the additional dependency. lib has the same functions as using namespace std; int main () {MYSQL mysql; mysql_init (& mysql); if (mysql_real_connect (& mysql, "localhost", "root ","", "course", 8080, 0, 0) {cout <"OK" <endl; return 0;} else {int I = mysql_errno (& mysql ); const char * s = mysql_error (& mysql); cout <s <endl;} return 0 ;}