Thanks for all the replies. I have all those out. It doesn't seem to work. I am getting the same error.
From: Keith Marshall [mailto:keithmarshall@...]
Sent: Tuesday, August 13, 2013 7:37 PM
Subject: Re: [Mingw-users] Unable to link to a .a file using g++
On 13/08/13 13:07, M G, Bharath Narayan wrote:
> I have a .a file to which I am trying to link my shared library. I
> have setup eclipse to use MinGW which is installed at c:\MinGW. I am
> compiling my code on eclipse but in essence it runs the following
> g++ -O0 -g3 -Wall -c -fmessage-length=0 -o wrapper.o "wrapper.cpp"
> g++ "-LC:\\eclipse\\workspace\\" -shared -o libwrapper.dll wrapper.o
> I get the following error during link time.
> cannot find -llibtp.a
> But I am sure that the file libtp.a is present at the location
> C:\eclipse\workspace. I have tried modifying the way I specify the
> library i.e., instead of -llibtp.a
-llibtp.a a is certainly wrong, (unless the library is actually called liblibtp.a.a, which seems unlikely); however...
> I gave -ltp.
-ltp should be correct.
> But nothing seems to work. What could be wrong?
I don't know. You seem to have supplied an appropriate library search path, with -LC:\\eclipse\\workspace\\, provided you've coupled this with -ltp. Try using $DEITY's preferred forward slashes, instead of backslashes, (which may be a cause of confusion, since it's not always clear how many reductions will occur). Also, omit the final slash on the -L specification, since some versions of gcc/ld are known to choke on them, so the linking command becomes:
g++ -L C:/eclipse/workspace -shared -o libwrapper.dll wrapper.o -ltp
(your extraneous quotes should be harmless, but I'd also be inclined to omit them; the stylistic space between -L and its argument shouldn't be necessary, but is my personal preference).
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
MinGW-users mailing list
This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
You may change your MinGW Account Options or unsubscribe at: