Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] How to link a library? Is the library tab missing - help says it should be there?

I am trying to link a library to a project. I thought this would be very simple so please in form me if I have missed the simple solution.

As far as I can see I first go to project properties. I then have two options:

Option 1:

C/C++ Build -> Settings -> MinGW C++ Linker -> Libaries
Add my libraries here. Should I use the full path to the library i.e. C:\MySQL++\lib\mysqlpp.dll? And should I place this in the -l or -L section? I am I correct in thinking that the -L area will link to the library as a dll but the -l area will compile the library into the exe.

Option 2:

C/C++ General -> Paths and Symbols

Now according to the help file there should be a Library Paths tab and a Libraries tab. I only have a Library Paths tab and no Libraries tab??? Is the help out of date? If so where should I add Libraries (besides the option I mentioned above)?

Some experimenting around in here revealed that if I add stuff to the Library Paths then it is added to the -L area discussed in Option 1 above. This is also true for include files you add to the Includes tab. Hence, I am guessing that this area is kind of a front end for the more complex and lower level C/C++ Build -> Settings. Without the Libraries tab however I am not sure how this would have added in libraries to the settings - I assume it would add them to the -l area.

Despite my attempts to add the library I cannot get my program to link correctly. I have tried:

# Library path in -L and library name in -l i.e. -LC:\MySQL++\lib\ and then -lmysqlpp.dll (oh and btw I am not appending the -l myself to the library I am letting Eclipse do that for me- so my entry looks like mysqlpp.dll)

#Full path in -L C:\MySQL++\lib\mysqlpp.dll

#Full path in -l C:\MySQL++\lib\mysqlpp.dll

#Full path in -l C:\MySQL++\lib\mysqlpp.dll and path in -LC:\MySQL++\lib\

none of these have worked so far - I get undefined reference to function errors.

Any help much appreciated.

Kind Regards

Dylan Reynolds

Back to the top