Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Eclipse C/C++ Static Library
Eclipse C/C++ Static Library [message #1692881] Mon, 20 April 2015 12:25 Go to next message
Nils Lukas is currently offline Nils LukasFriend
Messages: 1
Registered: April 2015
Junior Member
Dear all,

I am trying to use "Google Protobuf" for C++ in eclipse. Unfortunately I can't compile my Code because of unresolved references.
There is this "libprotobuf.lib" library on my Desktop, to which I am linking in the "Project->Properties->C/C++ General->Path and Symbols->Libraries" with the full path of the file. Moreover I added the Path to my Desktop in the "Library Paths" tab of the same panel.

When I try to build the Project with the following Command:
g++ -L"C:\Users\Overholt\Desktop" -o "CProtobuf"  ./src/CProtobuf.o ./src/addressbook.pb.o   -l"C:/Users/Overholt/Desktop/libprotobuf.lib"


eclipse outputs:
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lC:/Users/Overholt/Desktop/libprotobuf.lib


which I don't understand! The library is there, but why can't eclipse find it? Would be glad if someone could help me out on this one.. Confused

Best Regards
Overholt
Re: Eclipse C/C++ Static Library [message #1692929 is a reply to message #1692881] Mon, 20 April 2015 15:57 Go to previous message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 626
Registered: August 2014
Senior Member
The library file extension .lib makes me suspect that the library is not compatible with g++. A static library usually has an .a extension. You can try to feed the library to nm (you have mingw shell & utilities, msys installed?)

The command line is badly overspecified. You could try:

g++ -o "CProtobuf" ./src/CProtobuf.o ./src/addressbook.pb.o "C:/Users/Overholt/Desktop/libprotobuf.lib"

For more information on the GNU linker commands, google for gnu ld manual or gnu binutils manual.


--

Tauno Voipio
Previous Topic:Eclipse won't start, jdk is incompatible
Next Topic:javascript documntation
Goto Forum:
  


Current Time: Sat Mar 06 04:45:27 GMT 2021

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

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

Back to the top