Boost library eclipse linking error - c++

I'm working on windows 7 and eclipse juno. In my project i have linked correctly header-only boost libraries, and i need only two compiled libs ("libboost_signals-mgw46-mt-1_54.a" and "libboost_signals-mgw46-mt-d-1_54.a"). I added them to the MinGW C++ linker in the same way is explained here Linking Boost to my C++ project in Eclipse. The path i have specified in "Library search path" for the linker is "C:\MinGW\boost_1_54_0\stage\lib" (where compiled libraries reside) and the libraries themselves are added with their names except the ".a". But when i try to build the project i get this error:
Info: Internal Builder is used for build
g++ "-LC:\MinGW\boost_1_54_0\boost" -o Ccccc.exe "src\Ccccc.o" -llibboost_signals- mgw46-mt-1_54 -llibboost_signals-mgw46-mt-d-1_54
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find - llibboost_signals-mgw46-mt-1_54
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -llibboost_signals-mgw46-mt-d-1_54
collect2: ld returned 1 exit status
The code is irrelevant because in order to solve this problem i try to add those libraries to a simply "Hello world" project. Thanks for any help, sorry for my english.

Just a wild guess but try omitting the lib from the library name to see if it can find the library that way. Otherwise, clearly the library cannot be found in your library path.

Related

Unable to Compile openGL code in dev c++ [duplicate]

I'm using the <XZY> IDE to compile my program, and have some trouble to import/integrate a specific library with it.
I get error messages like
fatal error: 3rdPartyLib.h: No such file or directory
for a
#include "3rdPartyLib.h"
statement
ld.exe: cannot find `lib3rdParty.a`
for specifying
3rdParty
in the additional libraries
At least I got some error message like
undefined reference to `lib3rdParty::foo()'
What can I do to fix this?
It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.
See for example
c++ lib in two same project ,one can work but the other can 't
Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows
...
The problem is almost never related to the currently used IDE.
In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.
One of the major applicable answers for the linker related problems are
What is an undefined reference/unresolved external symbol error and how do I fix it?
undefined reference to `WinMain#16'
Most of the common IDEs provide features to configure this for a specific project. Here are some samples
Eclipse-CDT
Include path settings:
Library & library search path settings
Visual Studio 2013
Code Blocks
**DEV C++ (Bloodshed C++)
As from their FAQ:
9. How can i use the OpenGL library and others ?
All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way: lib*.a
To link a library with your project, just add in Project options, Further option files :
-lopengl32
This is for including the libopengl32.a library. To add any other library, just follow the same syntax:
Type -l (L in lowercase) plus the base name of the library (filename without lib and the .a extension).
You may also consider putting a -L option there to add directory pathes searched for libraries.
Qt Creator
In order to add include paths you have to open up the .pro file and then add
the directories to the INCLUDEPATH variable. These paths are separated by spaces. Reference can be found here.
If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:
It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.
For eclipse I use the pkg-config plugin where possible:
https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt
Failing that this configuration window:

How to link a library for Eclipse [duplicate]

I'm using the <XZY> IDE to compile my program, and have some trouble to import/integrate a specific library with it.
I get error messages like
fatal error: 3rdPartyLib.h: No such file or directory
for a
#include "3rdPartyLib.h"
statement
ld.exe: cannot find `lib3rdParty.a`
for specifying
3rdParty
in the additional libraries
At least I got some error message like
undefined reference to `lib3rdParty::foo()'
What can I do to fix this?
It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.
See for example
c++ lib in two same project ,one can work but the other can 't
Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows
...
The problem is almost never related to the currently used IDE.
In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.
One of the major applicable answers for the linker related problems are
What is an undefined reference/unresolved external symbol error and how do I fix it?
undefined reference to `WinMain#16'
Most of the common IDEs provide features to configure this for a specific project. Here are some samples
Eclipse-CDT
Include path settings:
Library & library search path settings
Visual Studio 2013
Code Blocks
**DEV C++ (Bloodshed C++)
As from their FAQ:
9. How can i use the OpenGL library and others ?
All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way: lib*.a
To link a library with your project, just add in Project options, Further option files :
-lopengl32
This is for including the libopengl32.a library. To add any other library, just follow the same syntax:
Type -l (L in lowercase) plus the base name of the library (filename without lib and the .a extension).
You may also consider putting a -L option there to add directory pathes searched for libraries.
Qt Creator
In order to add include paths you have to open up the .pro file and then add
the directories to the INCLUDEPATH variable. These paths are separated by spaces. Reference can be found here.
If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:
It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.
For eclipse I use the pkg-config plugin where possible:
https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt
Failing that this configuration window:

Errors on compiling solution with htmlcxx library [duplicate]

I'm using the <XZY> IDE to compile my program, and have some trouble to import/integrate a specific library with it.
I get error messages like
fatal error: 3rdPartyLib.h: No such file or directory
for a
#include "3rdPartyLib.h"
statement
ld.exe: cannot find `lib3rdParty.a`
for specifying
3rdParty
in the additional libraries
At least I got some error message like
undefined reference to `lib3rdParty::foo()'
What can I do to fix this?
It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.
See for example
c++ lib in two same project ,one can work but the other can 't
Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows
...
The problem is almost never related to the currently used IDE.
In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.
One of the major applicable answers for the linker related problems are
What is an undefined reference/unresolved external symbol error and how do I fix it?
undefined reference to `WinMain#16'
Most of the common IDEs provide features to configure this for a specific project. Here are some samples
Eclipse-CDT
Include path settings:
Library & library search path settings
Visual Studio 2013
Code Blocks
**DEV C++ (Bloodshed C++)
As from their FAQ:
9. How can i use the OpenGL library and others ?
All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way: lib*.a
To link a library with your project, just add in Project options, Further option files :
-lopengl32
This is for including the libopengl32.a library. To add any other library, just follow the same syntax:
Type -l (L in lowercase) plus the base name of the library (filename without lib and the .a extension).
You may also consider putting a -L option there to add directory pathes searched for libraries.
Qt Creator
In order to add include paths you have to open up the .pro file and then add
the directories to the INCLUDEPATH variable. These paths are separated by spaces. Reference can be found here.
If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:
It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.
For eclipse I use the pkg-config plugin where possible:
https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt
Failing that this configuration window:

OpenGL codeblocks compilation issue win7 [duplicate]

I'm using the <XZY> IDE to compile my program, and have some trouble to import/integrate a specific library with it.
I get error messages like
fatal error: 3rdPartyLib.h: No such file or directory
for a
#include "3rdPartyLib.h"
statement
ld.exe: cannot find `lib3rdParty.a`
for specifying
3rdParty
in the additional libraries
At least I got some error message like
undefined reference to `lib3rdParty::foo()'
What can I do to fix this?
It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.
See for example
c++ lib in two same project ,one can work but the other can 't
Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows
...
The problem is almost never related to the currently used IDE.
In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.
One of the major applicable answers for the linker related problems are
What is an undefined reference/unresolved external symbol error and how do I fix it?
undefined reference to `WinMain#16'
Most of the common IDEs provide features to configure this for a specific project. Here are some samples
Eclipse-CDT
Include path settings:
Library & library search path settings
Visual Studio 2013
Code Blocks
**DEV C++ (Bloodshed C++)
As from their FAQ:
9. How can i use the OpenGL library and others ?
All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way: lib*.a
To link a library with your project, just add in Project options, Further option files :
-lopengl32
This is for including the libopengl32.a library. To add any other library, just follow the same syntax:
Type -l (L in lowercase) plus the base name of the library (filename without lib and the .a extension).
You may also consider putting a -L option there to add directory pathes searched for libraries.
Qt Creator
In order to add include paths you have to open up the .pro file and then add
the directories to the INCLUDEPATH variable. These paths are separated by spaces. Reference can be found here.
If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:
It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.
For eclipse I use the pkg-config plugin where possible:
https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt
Failing that this configuration window:

How to configure Boost with Netbeans 6.9 on Ubuntu

I have gcc 4.4.5 and the latest boost library. I want to use boost specifically for its regex library. I tried using the built in c++ regex functions but apparently they are not fully functional yet. I followed a tutorial online to set up netbeans.
I added /usr/include/boost to the c++ code assistance include directories. I then added -lboost_regex-mt to the build>linker>additional options area in the project configuration. but I still get this error:
/usr/bin/ld: cannot find -lboost_regex-mt
collect2: ld returned 1 exit status
This is the command thats being created by netbeans:
g++ -lboost_regex-mt -o dist/Debug/GNU-Linux-x86/examples01 build/Debug/GNU-Linux-x86/main.o
I also tried doing it with -lboost-regex and -lboost-regex-st and the same error, with only the mt changed.
I also tried running a file using regex objects through the terminal but still got the same error. Can anyone help with this problem? Or at least point me in the right direction?
You have to set your project's "Additional Library Directories" so that it knows what other directories to look into for your libraries to link against.
Here's a screenshot from Netbeans' site here: http://netbeans.org/community/magazine/html/03/c++/
edit: note that this will affect the generated compiler command to have -L options which specify additional locations to look for library files.
You need to tell g++ where to find the libraries. One way doing this is to append the location of boost's libraries to your LD_LIBRARY_PATH. Note that this is not the same as the header files (the .hpp files in the include directory) which you said you've already included in your project.