Hi,
I am trying my hands on compiling a C program using the API from mysql. The below is my simple program:
I manage to compile using the below:Code:#include <stdio.h> #include <mysql.h> MYSQL *conn; int main(int argc, char *argv[]) { printf("Hello, world and Goodbye\n"); }
C:\project\code>cl -c -I "C:\Program Files\MySQL\MySQL Server 4.1\include" clien
t1.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
client1.c
However when linking I got the following error:
C:\project\code>cl client1.obj -link
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
/out:client1.exe
client1.obj
client1.obj : error LNK2019: unresolved external symbol _mysql_close@4 reference
d in function _main
client1.obj : error LNK2019: unresolved external symbol _mysql_real_connect@32 r
eferenced in function _main
client1.obj : error LNK2019: unresolved external symbol _mysql_init@4 referenced
in function _main
client1.exe : fatal error LNK1120: 3 unresolved externals
Thanks in advance