Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Can't link libs - help please!(problem linking with external libraries)
Can't link libs - help please! [message #1061996] Wed, 05 June 2013 10:16 Go to next message
Peter Ritter is currently offline Peter RitterFriend
Messages: 2
Registered: March 2013
Junior Member

Hello

I just recently moved to Eclipse CDT after 15 years of MS Visual Studio, and I have to say that so far - I love it. It took a little while to get used to and configure the IDE, but overall Eclipse is great - especially the multithreaded compiling which is just insanely fast on my 6 core pc.

However, I have run into a problem which is driving me mad. I am currently porting a charting library which uses the GD graphics library. I now realize that I spent the last few month working on my own code and hadn't linked to any external libs at all. So, configuring the link directories and lib files was something I hadn't done so far. And I can't get it to work for the life of me. There is probably a really simple solution for this, but I don't see it. I need to link to two lib files:
1) libTSAPI.a
2) libgd.so

in their respective directories:
1)/home/peter/_PR_DEV_/DEV_PROJECTS/EclipseProjects/TSAPI/Debug
2)/usr/lib64

I have set this up using the Eclipse IDE in
Project-> Properties-> GCC C++ Linker -> Libraries

I have dropped the 'lib' prefix and the compiler/linker now give me the following message:

Building target: TS_CHART
Invoking: GCC C++ Linker
g++ -L/usr/lib64 -L/home/peter/_PR_DEV_/DEV_PROJECTS/EclipseProjects/TSAPI/Debug -o "TS_CHART" ./Testing/MainDriver.o ./Testing/TSC_TESTING.o ./Testing/TSC_TEST_ChartBasic.o ./Testing/TSC_TEST_ChartMaker.o ./Testing/TSC_TEST_HighLevel.o ./Source/TSCChartBorder.o ./Source/TSCChartMaker.o ./Source/TSCColor.o ./Source/TSCDataSeries.o ./Source/TSCIcons.o ./Source/TSCImage.o ./Source/TSCPane.o ./Source/TSCPaneHeader.o ./Source/TSCPlotArea.o ./Source/TSCPlots.o ./Source/TSCPositionChart.o ./Source/TSCPriceAxis.o ./Source/TSCPriceLegend.o ./Source/TSCPropertyMap.o ./Source/TSCTimeLegend.o ./Source/TSCWrapper.o -lgd.so -lTSAPI.a
/usr/bin/ld: cannot find -lgd.so
/usr/bin/ld: cannot find -lTSAPI.a
collect2: error: ld returned 1 exit status
make: *** [TS_CHART] Error 1

So, it cannot find either library! I have checked both directories give with -L in a terminal and I'm sure they exist and that the lib files are in them. Why does the linker not find them? I spent most of my day on this yesterday, and I feel I learned quite a bit about how to get around the Eclipse IDE, but was not able to build my project. I would really appreciate if somebody could give me a hint on what I'm doing wrong.

Best Regards, Peter Ritter


Re: Can't link libs - help please! [message #1062072 is a reply to message #1061996] Wed, 05 June 2013 16:59 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
You need to drop the suffixes (.so and .a) as well. The library names should be gd an TSAPI.
Re: Can't link libs - help please! [message #1062145 is a reply to message #1062072] Thu, 06 June 2013 08:47 Go to previous message
Peter Ritter is currently offline Peter RitterFriend
Messages: 2
Registered: March 2013
Junior Member
Hi David

>>>You need to drop the suffixes (.so and .a) as well.

Thank you so much David!! It worked. I thought I was acting informed by dropping the prefix. Strangely enough it didn't even occur to me that dropping the suffixes was even a possibility otherwise I'd have tried that. Must be a form of platform brainwash.

At least I can get on with work now. I am very grateful for the help!

Best Regards, Peter
Previous Topic:CDT Code Formatting and struct operators
Next Topic:CDT and friends
Goto Forum:
  


Current Time: Sun Oct 06 23:46:57 GMT 2024

Powered by FUDForum. Page generated in 0.03942 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top