cannot find -llibboost_regex in boost 1.62.0 in linux opensuse - c++

I am just trying to run replace_regex_copy in my code. For that I have included regex.hpp file. At the start it showed some errors like Unreferenced includes something like that. I googled it, I found that need to include -llibboost_regex in the linker. But after including that I am getting linker error as cannot find -libboost_regex.
But I have libboost_regex.a and libboost_regex.so in boost/lib folder.
Eclipse configuration I made:
Under GCC C++ Linker:
Libraries (-l) libboost_regex
Library Search Path (-L) /boost/lib
Even I tried to give entire path with the file in Libraries(-l) too. But nothing helps.
Still am getting cannot find -llibboost_regex error. Can anyone help me out?

Related

Why can't I link this library using the GNU GCC Compiler on Windows (but on Linux I can)

I've been trying to link this CryptoPP library for some time now; no luck. Due to most of the resources relating to linking the CryptoPP library being on the Linux platform I temporarily installed Ubuntu on a VM and got CryptoPP working quite smoothly, however, as previously mentioned, it doesn't work on Windows.
I am using the CodeBlocks IDE on Windows 8 using the MinGW compiler.
I already have the static CryptoPP .a file built.
My 2 attempts at linking the CrypoPP library have been:
A:
- Add the locations of the header files to the compiler and linker search directories (so it doesn't give me those "Head not found" errors)
Add the library to the Link Libraries section (I added "libcryptopp")
I know that the compiler can see the Linked Library because when I change the name to the libcryptopp.a file to something else (libcryptopp1.a) it says "-llibcryptopp not found"
In the end I get a whole bunch of Undefined API error messages :(
B: I then tried to add the header and library files to my compiler directory in suspicion of my IDE's search directory somehow failing me, this was not the case; I received the same Undefined API error messages.
I am tired of fighting this, if anyone could please leave some tips or point something out that I'm doing wrong I would be very grateful.

C++ Eclipse use libraries

I am currently encountering a few errors with Eclipse c++. I am a complete newbie to c++ and because I knew Eclipse from java I thought it might be ok. Now to the issue:
I want to use the curl library, but I have no idea how to include it correct. Everywhere around the internet I found that I have to go to the compiler settings, include the library there, go to the linker settings and include it there as well. Now the linker has 2 different panels, one for Libraries (-l) and one for Library paths (-L).
I have downloaded the curl library to this directory:
C:\Users\Hannes\Desktop\eclipseC\curl-7.45.0
How do I have to include the Library correctly now?
Here is the error:
g++ "-LC:\Users\Hannes\Desktop\eclipseC\curl-7.45.0\include\curl" -o HelloWorld.exe HelloWorld.o -lcurl
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lcurl
In the editor the automatic completion for curl methods does work.
EDIT: Removing \include\curl from the Library path (-L) didn't work as well.
You have included what looks to be an include path not the library path. Is there a /lib directory under the curl path?
The c/c++ includes should be the path to the header files for curl, the linker path should be to the libraries not the headers, so .a and .dll files normally (normally under a /lib directory).

Specifying correct library to link in Xcode when multiple copies exist on search path

I am trying to compile a C++ file that depends on ffmpeg. I have spent a long time trying to fix all the link errors. I found that on the Mac it needs:
libbz2.dylib
libiconv.dylib
libz.dylib
libavcodec.a
libavformat.a
libswscale.a
libswresample.a
VideoDecodeAcceleration.framework
CodeVideo.framework
CoreFoundation.framework
The problem I have is that I still get symbol link errors for libiconv even though the library is present in /usr/lib and all the other libraries in this directory are being found there. The compile line includes -liconv.2
On searching around I found that the problem comes from there being two version of libiconv on my system. One is in /usr/lib and the other is in /opt/local/lib. The one in /usr/lib exports symbols that ffmpeg uses named like "_iconv_open", whereas the one in /opt/local/lib exports the same symbols with "lib" added, e.g. "_libiconv_open". It seems the compiler is picking up the /opt/local/lib library.
How can I get Xcode to pick up the correct lib?

Link error with libCGAL-vc120-mt-sgd-4.5.1.lib and cant seem to find or build it

Hey I'm a bit of a noob when it comes to CGAL and CMake but I've gotten to the point where everything seems to be running except for this link error:
LINK : fatal error LNK1104: cannot open file 'libCGAL-vc120-mt-sgd-4.5.1.lib'
trouble is I cant seem to find a reference to this lib anywhere am I building wrong?
I can see a 'libCGAL-vc120-mt-gd-4.5.1.lib' in my cgal lib dir which links fine. I'm not sure what the difference between gd and sgd is though and how to make it.
Any help is appreciated.
The naming libCGAL-vc120-mt-sgd-4.5.1.lib shows that you are compiling a program, that uses CGAL, using the linker flag /MTd (Debug, and link the C++ runtime statically).
The CMake scripts of CGAL do not support linking with the static runtime. They only support /MD or /MDd. I suggest you change that linker flag in your setup.
Alternately, you can try to change the CMake scripts of CGAL, but I do not recommend that solution.

Compiler unable to find valid library path

I'm getting the following error:
ld.exe||cannot find -lD:\Libraries\boost_1_47_0\boost_1_47_0\stage\lib|
Even though the path is valid. Any thoughts on that?
Edit:
Thanks MichalR!
For others, in order to configure boost for gcc:
Download boost
install it according to instructions from boost site
In code::blocks in Settings/global variables add path to your boost library for base and lib fields (this should be located in stage/lib folder)
In code::blocks in Project/Build options..., linker settings tab, link libraries - add here those libraries
In code::blocks in Project/Build options...Search directories tab in compiler subtab add $(#boost) and in linker subtab add $(#boost.lib).
Done. I spent a few days on this, but it was worth it. Now I can use this great IDE with gcc compiler which at the moment of this writing is miles ahead of MS. I am not being stopped in my personal development by MS - C++11 here I come!
The params for ld are e.g.:
-larchive
-Lsearch_path
The first tells what library to look for, the latter specifies library search paths.
Perhaps you have these options mixed in your command line - it looks you have -l with a directory parameter.