Fejl når jeg kompilerer et mysql-eksempel

Tags:    c++ c++

Når jeg kompilerer et mysql-eksempel i c++ skriver den følgende fejlmeddelelser:

--------------------Configuration: main - Win32 Debug--------------------
Compiling...
main.cpp
c:\\mysqlvcapi\\mysql\\include\\mysql_com.h(115) : error C2146: syntax error : missing ';' before identifier 'fd'
c:\\mysqlvcapi\\mysql\\include\\mysql_com.h(115) : error C2501: 'SOCKET' : missing storage-class or type specifiers
c:\\mysqlvcapi\\mysql\\include\\mysql_com.h(115) : error C2501: 'fd' : missing storage-class or type specifiers
d:\\my documents\\cpp\\mysql\\main.cpp(26) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'unsigned int', possible loss of data
Error executing cl.exe.

main.obj - 3 error(s), 1 warning(s)

Jeg ved ikke om jeg har installeret mysql++ API'et for visual c++ ordentligt... jeg håber der er nogen der kan hjælpe mig

her er min kode:

Fold kodeboks ind/udKode 




7 svar postet i denne tråd vises herunder
0 indlæg har modtaget i alt 0 karma
Sorter efter stemmer Sorter efter dato
SOCKET er defineret i winsock.h ...

Proev at inkludere den.




SOCKET er defineret i winsock.h ...

Proev at inkludere den.


det gjorde ingen forskel :-(



SOCKET er defineret i winsock.h ...

Proev at inkludere den.


det gjorde ingen forskel :-(


Inkluderede du den før eller efter mysql.h? Det skal være før...



SOCKET er defineret i winsock.h ...

Proev at inkludere den.


det gjorde ingen forskel :-(

Inkluderede du den før eller efter mysql.h? Det skal være før...


Nu skriver den sådan her:

--------------------Configuration: main - Win32 Debug--------------------
Compiling...
main.cpp
d:\\my documents\\cpp\\mysql\\main.cpp(28) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'unsigned int', possible loss of data
Linking...
main.obj : error LNK2001: unresolved external symbol _mysql_close@4
main.obj : error LNK2001: unresolved external symbol _mysql_num_fields@4
main.obj : error LNK2001: unresolved external symbol _mysql_fetch_row@4
main.obj : error LNK2001: unresolved external symbol _mysql_num_rows@4
main.obj : error LNK2001: unresolved external symbol _mysql_store_result@4
main.obj : error LNK2001: unresolved external symbol _mysql_query@8
main.obj : error LNK2001: unresolved external symbol _mysql_real_connect@32
main.obj : error LNK2001: unresolved external symbol _mysql_init@4
Debug/main.exe : fatal error LNK1120: 8 unresolved externals
Error executing link.exe.

main.exe - 9 error(s), 1 warning(s)



--------------------Configuration: main - Win32 Debug--------------------
Compiling...
main.cpp
d:\\my documents\\cpp\\mysql\\main.cpp(28) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'unsigned int', possible loss of data
Linking...
main.obj : error LNK2001: unresolved external symbol _mysql_close@4
main.obj : error LNK2001: unresolved external symbol _mysql_num_fields@4
main.obj : error LNK2001: unresolved external symbol _mysql_fetch_row@4
main.obj : error LNK2001: unresolved external symbol _mysql_num_rows@4
main.obj : error LNK2001: unresolved external symbol _mysql_store_result@4
main.obj : error LNK2001: unresolved external symbol _mysql_query@8
main.obj : error LNK2001: unresolved external symbol _mysql_real_connect@32
main.obj : error LNK2001: unresolved external symbol _mysql_init@4
Debug/main.exe : fatal error LNK1120: 8 unresolved externals
Error executing link.exe.

main.exe - 9 error(s), 1 warning(s)


Project->Settings->Link

Tilfoej "libmySQL.lib" til Object/Library Modules ...




--------------------Configuration: main - Win32 Debug--------------------
Compiling...
main.cpp
d:\\my documents\\cpp\\mysql\\main.cpp(28) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'unsigned int', possible loss of data
Linking...
main.obj : error LNK2001: unresolved external symbol _mysql_close@4
main.obj : error LNK2001: unresolved external symbol _mysql_num_fields@4
main.obj : error LNK2001: unresolved external symbol _mysql_fetch_row@4
main.obj : error LNK2001: unresolved external symbol _mysql_num_rows@4
main.obj : error LNK2001: unresolved external symbol _mysql_store_result@4
main.obj : error LNK2001: unresolved external symbol _mysql_query@8
main.obj : error LNK2001: unresolved external symbol _mysql_real_connect@32
main.obj : error LNK2001: unresolved external symbol _mysql_init@4
Debug/main.exe : fatal error LNK1120: 8 unresolved externals
Error executing link.exe.

main.exe - 9 error(s), 1 warning(s)

Project->Settings->Link

Tilfoej "libmySQL.lib" til Object/Library Modules ...


tak! nu virker det!



Mads skal lige sætte et svar op, før du kan give ham de 100 UP
Med Venlig Hilsen: CHadi
http://chadi.h4f.dk



t