News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Linking to libraries in CodeBlocks

Started by Durango2007, September 05, 2007, 10:05:28 AM

Previous topic - Next topic

Durango2007

Hello I am new to CodeBlocks and I am learning as I go, please have patience with me  :)

I have decided to pick up C again and my previous development environment was Unix using gnu-c compiler.
Currently I am trying to compile a simple program that makes use of the mysql database.
I do have path to the mysql database libraries but when I include the paths in codeblocks it seems to not pick them up  :?

Suppose the library file is D:\mysql\lib\opt\mysqlclient.lib

I want to add the path D:\mysql\lib\opt\ as my included library path.

Where in CodeBlocks is this done?

I tried going to Settings->Compiler and Debugger... than I selected the Linker Settings tab and added the lib file I needed.  I also included the path to the lib file in the search directory's linker section, and still I cannot access it.
I am using the Mingw comiler that I installed.

If anyone has any idea I would appreciate it.

Thank you :D

eranif

The '.lib' extension implies that you are using mysqlclient library built using MSVC. You should get library that was built against mingw compiler. Maybe C::B did found it by the linker refuses to use it. Try also posting some of the compiler (or in your case, the linker) output - this could help people to give you more accurate answers.

HTH,
Eran


Durango2007

Here is the compiler build log:

mingw32-g++.exe -Wall  -IE:\MinGW\include  -c "C:\Documents and Settings\Durango\code\C\mySqlTest.c" -o "C:\Documents and Settings\Durango\code\C\mySqlTest.o"

C:\Documents and Settings\Durango\code\C\mySqlTest.c:3:19: mysql.h: No such file or directory
C:\Documents and Settings\Durango\code\C\mySqlTest.c:5: error: `MYSQL' does not name a type
C:\Documents and Settings\Durango\code\C\mySqlTest.c: In function `int main()':
C:\Documents and Settings\Durango\code\C\mySqlTest.c:10: error: `mysql' undeclared (first use this function)
C:\Documents and Settings\Durango\code\C\mySqlTest.c:10: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:\Documents and Settings\Durango\code\C\mySqlTest.c:10: error: `mysql_init' undeclared (first use this function)
Process terminated with status 1 (0 minutes, 0 seconds)
5 errors, 0 warnings


It does not seem to include a link to the library in there and I don't know where I have to set this up.

darthdespotism


Lobotomy

I had the same problem just yesterday and solution was found at French site. From there I downloaded the archive with missing file libmysqlclient.a which should included to "link libraries" list in "Project build options" window. And it works successfully now!