Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Help pls...linking to a lib is not working(Trying to use Myo64.lib on windows 7....)
Help pls...linking to a lib is not working [message #1716209] Wed, 02 December 2015 08:56 Go to next message
ingo stein is currently offline ingo steinFriend
Messages: 1
Registered: December 2015
Junior Member
Hey guys...
I don't get it....
I want to use the Myo64.lib from the Myo Wristband but i'm not able (or maybe just to sutpid) to set up the program correctly.

The code is just a sample and the error does not look like an code-error.
So this is my error i'm getting:

09:43:00 **** Incremental Build of configuration Debug for project Myo_Tests ****
Info: Internal Builder is used for build
g++ "-LC:\\Users\\Computer\\workspace\\Myo_Tests\\libs" -o Myo_Tests.exe "src\\hello-myo.o" -lmyo64.lib 
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lmyo64.lib
collect2.exe: error: ld returned 1 exit status

09:43:00 Build Finished (took 236ms)


I set the System Pathvariable to
C:/MinGW/bin

the libraries to
Myo64.lib

the Library Path to
/$(ProjName)/libs

and ofc the Myo64.lib is existing in this project folder

If anyone could help me,this would be awesome^^
Thank you!
Re: Help pls...linking to a lib is not working [message #1716289 is a reply to message #1716209] Wed, 02 December 2015 17:22 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
According to the GNU ld documentation -lxxx is converted to libxxx.so or libxxxx.a so it is looking for libmyo64.lib.a or libmyo64.lib.so in your case.
https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html
I haven't built anything for Windows for some time but one way around this is to just put the full path to the library as a file to be linked without any preceding -l. This may drag in the entire library.


Here is some specific documentation at MinGW for linking libraries
http://www.mingw.org/wiki/specify_the_libraries_for_the_linker_to_use

And according to it:
if you have a library named according to the aberrant "lib<name>.lib" convention, it will not be found by an "-l<name>" specification -- if you cannot rename the library, you must use the form "-llib<name>"

HTH

[Updated on: Wed, 02 December 2015 17:27]

Report message to a moderator

Re: Help pls...linking to a lib is not working [message #1716312 is a reply to message #1716209] Wed, 02 December 2015 20:50 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
Check the library capitalization: myo64.lib is different from Myo64.lib.

--

Tauno Voipio
Re: Help pls...linking to a lib is not working [message #1716316 is a reply to message #1716312] Wed, 02 December 2015 22:34 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
FWIW:
I tried a project (HelloWorldC++) with an empty myo64.lib in directory libs.

I was unable to get the GNU loader to find it using the following command in the HelloWorldC++ project directory:
g++ HelloWorldC++.o -Llibs -lmyo64
g++ HelloWorldC++.o -o HelloWorldC++ -Llibs -llibmyo64
g++ HelloWorldC++.o -Llibs -llibmyo64.lib


All of the above resulted in ld: cannot find ....

It did finally work when I used:
g++ HelloWorldC++.o -o HelloWorldC++ libs/libmyo64.lib
although I got: libs/libmyo64.lib: file not recognized: File truncated
but I expected this because the file is empty.

It seems the only way to get the library is to explicitly place it on the command line as if it were an object file.
According to the e ld documentation the only difference between -lNAM and /pathtolibs/libNAM.a is that -l surrounds NAM appropriately.
It's not clear though if a file without .a or .so will be treated as a library.

Previously I had linked to an older version of the ld manual.
The newer one is https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

Although Windows files aren't case sensitive, some linux commands still have case sensitive file searches. So, as Tauno suggests, use the proper case in the name to be sure.

Re: Help pls...linking to a lib is not working [message #1716330 is a reply to message #1716316] Thu, 03 December 2015 04:57 Go to previous message
Alva Christeen is currently offline Alva ChristeenFriend
Messages: 6
Registered: December 2014
Junior Member
thanks
Previous Topic:Debug perspective behavior on thread context change
Next Topic:How to toggle compilers in cross enviromment
Goto Forum:
  


Current Time: Fri Apr 26 14:43:23 GMT 2024

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

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

Back to the top