C++ boost build errors - c++

we use boost1.46.1 in our c++ project. When I am building my c++ project using cmake, I am getting following errors.
I am not sure why I am getting this error. Can any one please hemp me to fix the following errors?
/usr/bin/ld: warning: libicuuc.so.44, needed by /efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicui18n.so.44, needed by /efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicudata.so.44, needed by /efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so, not found (try using -rpath or -rpath-link)
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_isspace_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `icu_44::Collator::createInstance(icu_44::Locale const&, UErrorCode&)'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_charFromName_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_charType_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_digit_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_tolower_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `icu_44::Locale::~Locale()'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_isblank_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `icu_44::Locale::Locale()'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `icu_44::Locale::Locale(icu_44::Locale const&)'
collect2: ld returned 1 exit status

http://www.boost.org/doc/libs/1_47_0/libs/regex/doc/html/boost_regex/install.html
It looks like boost::regex sometimes depends on the ICU library. You can either link against that library, or you can follow the instructions in the link to disable ICU.

Your Boost.Regex is built with Unicode support — you need to link to ICU as well.

Related

C++: matplotlibcpp.h and Python.h linker error

I am finding trouble linking a library in C++.
I am trying for the first time to use "matplotlibcpp.h". This is a library that uses "Python.h"
My code is not using either of the libraries yet. It gives error just by including "matplotlibcpp". I am using python2.7 and Ubuntu 18.04 and am using Eclipse.
The code does not run if I include:
#include "matplotlibcpp.h" // programme runs if this is commented out. But I need it to add new features.
#include "Python.h"
I have added these paths in several futile attempts (they solved similar issues to other threads):
GCC C++ Compiler, include paths (-l)
/home/toni/Programs/Workspace/Libraries/matplotlib-cpp-master/
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy
/usr/include/python2.7
GCC C++ Linker, Library search path (-L)
/home/toni/Programs/Workspace/Libraries/matplotlib-cpp-master/
/usr/lib/python2.7/config-i386-linux-gnu
/usr/lib/python2.7
/usr/include/python2.7
The programme builds, but does not run:
Finished building: ../src/WindProfilesCoursera.cpp
Building target: WindProfilesCoursera
Invoking: GCC C++ Linker
g++ -L/home/toni/Programs/Workspace/Libraries/matplotlib-cpp-master/ -L/usr/lib/python2.7/config-i386-linux-gnu -L/usr/lib/python2.7 -L/usr/include/python2.7 -o "WindProfilesCoursera" ./src/WindProfilesCoursera.o
./src/WindProfilesCoursera.o: In function `_import_array':
/usr/include/python2.7/numpy/__multiarray_api.h:1456: undefined reference to `PyImport_ImportModule'
makefile:45: recipe for target 'WindProfilesCoursera' failed
/usr/include/python2.7/numpy/__multiarray_api.h:1460: undefined reference to `PyExc_ImportError'
/usr/include/python2.7/numpy/__multiarray_api.h:1460: undefined reference to `PyErr_SetString'
/usr/include/python2.7/numpy/__multiarray_api.h:1463: undefined reference to `PyObject_GetAttrString'
/usr/include/python2.7/numpy/__multiarray_api.h:1466: undefined reference to `PyExc_AttributeError'
/usr/include/python2.7/numpy/__multiarray_api.h:1466: undefined reference to `PyErr_SetString'
/usr/include/python2.7/numpy/__multiarray_api.h:1478: undefined reference to `PyCObject_Type'
/usr/include/python2.7/numpy/__multiarray_api.h:1479: undefined reference to `PyExc_RuntimeError'
/usr/include/python2.7/numpy/__multiarray_api.h:1479: undefined reference to `PyErr_SetString'
/usr/include/python2.7/numpy/__multiarray_api.h:1483: undefined reference to `PyCObject_AsVoidPtr'
/usr/include/python2.7/numpy/__multiarray_api.h:1487: undefined reference to `PyExc_RuntimeError'
/usr/include/python2.7/numpy/__multiarray_api.h:1487: undefined reference to `PyErr_SetString'
/usr/include/python2.7/numpy/__multiarray_api.h:1493: undefined reference to `PyExc_RuntimeError'
/usr/include/python2.7/numpy/__multiarray_api.h:1493: undefined reference to `PyErr_Format'
/usr/include/python2.7/numpy/__multiarray_api.h:1499: undefined reference to `PyExc_RuntimeError'
/usr/include/python2.7/numpy/__multiarray_api.h:1499: undefined reference to `PyErr_Format'
/usr/include/python2.7/numpy/__multiarray_api.h:1511: undefined reference to `PyExc_RuntimeError'
/usr/include/python2.7/numpy/__multiarray_api.h:1511: undefined reference to `PyErr_Format'
/usr/include/python2.7/numpy/__multiarray_api.h:1522: undefined reference to `PyExc_RuntimeError'
/usr/include/python2.7/numpy/__multiarray_api.h:1522: undefined reference to `PyErr_Format'
collect2: error: ld returned 1 exit status
make: *** [WindProfilesCoursera] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
20:35:04 Build Failed. 22 errors, 1 warnings. (took 2s.454ms)

compiling c++ with external library : lpsolve

I am trying to compile a program written in C++ using the lpsolve external library.
I have written the following line in my .cpp :
#include</var/lib/lpsolve/lp_lib.h>
However, when I'm trying to compile this using g++, I get this weird message :
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/liblpsolve55.so when searching for -llpsolve55
/usr/bin/ld: skipping incompatible /usr/lib/../lib/liblpsolve55.so when searching for -llpsolve55
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/../../../liblpsolve55.so when searching for -llpsolve55
/usr/bin/ld: skipping incompatible //usr/local/lib/liblpsolve55.so when searching for -llpsolve55
/usr/bin/ld: skipping incompatible //usr/local/lib/liblpsolve55.a when searching for -llpsolve55
/usr/bin/ld: skipping incompatible //usr/lib/liblpsolve55.so when searching for -llpsolve55
/usr/bin/ld: cannot find -llpsolve55
/usr/bin/ld: cannot find -lcolamd
collect2: error: ld returned 1 exit status
I tried many different things... Even tried to install the library manually, by downloading it from sourceforge taking care of the right version (dev-ux64 in my case) and it seems like none of the solutions I've found on the internet are working ...
By the way, I am using the following command to compile my program :
g++ prog.cpp -llpsolve55 -lcolamd -ldl -o MyExe
EDIT : after specifying the path to the librairies explicitly, i get this :
/tmp/ccIvoPiS.o: In function `main':
flot_max.cpp:(.text+0x36): undefined reference to `make_lp'
flot_max.cpp:(.text+0xd7): undefined reference to `set_int'
flot_max.cpp:(.text+0x159): undefined reference to `set_maxim'
flot_max.cpp:(.text+0x16c): undefined reference to `set_obj_fn'
flot_max.cpp:(.text+0x1d6): undefined reference to `add_constraint'
flot_max.cpp:(.text+0x240): undefined reference to `add_constraint'
flot_max.cpp:(.text+0x2aa): undefined reference to `add_constraint'
flot_max.cpp:(.text+0x314): undefined reference to `add_constraint'
flot_max.cpp:(.text+0x37e): undefined reference to `add_constraint'
/tmp/ccIvoPiS.o:flot_max.cpp:(.text+0x3e8): more undefined references to `add_constraint' follow
/tmp/ccIvoPiS.o: In function `main':
flot_max.cpp:(.text+0x6a4): undefined reference to `solve'
flot_max.cpp:(.text+0x6bd): undefined reference to `get_objective'
flot_max.cpp:(.text+0x704): undefined reference to `get_variables'
collect2: error: ld returned 1 exit status
It just looks like the library isn't loaded as every function listed above are part of the library...

Eclipse, MinGW, Freeglut undefined reference

I've been trying to compile this OpenGL tutorial (originally purposed for Visual Studio) but I keep having 'undefined reference' errors. The compiler output is as follows:
Info: Internal Builder is used for build
g++ -o OpenGLTutorial.exe "src\\main.o" "src\\Camera.o" -lglew32 -lglu32 -lopengl32 -lfreeglut
src\main.o: In function `Z6InitGLiPPc':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:75: undefined reference to `glutInit'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:76: undefined reference to `glutSetOption'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:77: undefined reference to `glutGet'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:78: undefined reference to `glutGet'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:80: undefined reference to `glutInitDisplayMode'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:82: undefined reference to `glutInitContextVersion'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:83: undefined reference to `glutInitContextProfile'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:84: undefined reference to `glutInitContextFlags'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:86: undefined reference to `glutInitWindowPosition'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:87: undefined reference to `glutInitWindowSize'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:89: undefined reference to `glutCreateWindow'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:91: undefined reference to `glutIdleFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:92: undefined reference to `glutDisplayFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:93: undefined reference to `glutKeyboardFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:94: undefined reference to `glutKeyboardUpFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:95: undefined reference to `glutSpecialFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:96: undefined reference to `glutSpecialUpFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:97: undefined reference to `glutMouseFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:98: undefined reference to `glutMotionFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:99: undefined reference to `glutReshapeFunc'
src\main.o: In function `main':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:236: undefined reference to `glutMainLoop'
src\main.o: In function `Z9ReshapeGLii':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:249: undefined reference to `glutPostRedisplay'
src\main.o: In function `Z9DisplayGLv':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:262: undefined reference to `glutSwapBuffers'
src\main.o: In function `Z6IdleGLv':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:278: undefined reference to `glutPostRedisplay'
src\main.o: In function `Z10KeyboardGLhii':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:313: undefined reference to `glutLeaveMainLoop'
collect2.exe: error: ld returned 1 exit status
21:39:05 Build Finished (took 1s.154ms)
Can anyone tell me what is wrong?
If you need any more information to help answer the question just ask.
Edit (Some additional info):
As you can see from the compiler output I have linked the library that these functions require and the compiler does not complain that it could not find said library. Also I placed the freeglut dll into the binary folder.
This problem was apparently mainly due to user error and was completely circumstantial. I'm posting this for the people of the future who might have this problem.
In my header file I defined FREEGLUT_STATIC. After changing this to another variable, the linker no longer produced errors. Though I can't actually check -- very easily at least -- somewhere in my freeglut library this variable was used in an ifndef statement to determine whether freeglut needed to be linked (in case it was already linked).

linker error while building roborobo using SDL

I'm using robo robo simulator. It requires SDL to be installed. SDL was successfully installed using sudo apt-get install in Ubuntu
'make' was used to compile and link.
compilation was successful but while linking I got the following linker errors
[LD] roborobo
src/core/roborobo.o: In function `clean_up()':
roborobo.cpp:(.text+0x29): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x35): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x41): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x4d): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x59): undefined reference to `SDL_FreeSurface'
src/core/roborobo.o:roborobo.cpp:(.text+0x6a): more undefined references to `SDL_FreeSurface' follow
src/core/roborobo.o: In function `checkQuitEvent()':
roborobo.cpp:(.text+0xdff): undefined reference to `SDL_PollEvent'
src/core/roborobo.o: In function `handleKeyEvent(unsigned char*)':
roborobo.cpp:(.text+0xead): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0xf1a): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0xf43): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0x1037): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0x111e): undefined reference to `SDL_Delay'
src/core/roborobo.o:roborobo.cpp:(.text+0x1191): more undefined references to `SDL_Delay' follow
and many more
SDL_gfxPrimitives.c:(.text+0x7477): undefined reference to `SDL_UnlockSurface'
SDL_gfxPrimitives.c:(.text+0x7491): undefined reference to `SDL_UpperBlit'
SDL_gfxPrimitives.c:(.text+0x74e6): undefined reference to `SDL_CreateRGBSurface'
collect2: error: ld returned 1 exit status
make: [roborobo] Error 1 (ignored)
the make file also has sdl-config --cflags --libs -lSDL_image
the Makefile is in http://pastebin.com/5EdcZWAd
the entire console output after 'make' is in http://pastebin.com/yXDHR9xw

linking error compiling with Qt 4

I have a project which i started building with QT5 but since other people in the company use QT4, I tried making it back compatible. I was able to get all the includes etc work right but there is a linking error I can't figure out.
The error is :
compiling gen/Release/obj/qrc_map_markup_gui.cpp
linking bin/visual_route_generationmap_markup_gui
/usr/bin/ld: warning: libicui18n.so.49, needed by /other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicuuc.so.49, needed by /other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_compareNames_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucol_close_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucol_setAttribute_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_toUnicode_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ures_getStringByKey_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `u_strToUpper_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_countAvailable_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucol_open_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `u_strToLower_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_getDefaultName_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_getStandardName_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucol_getAttribute_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_countAliases_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ures_open_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ures_close_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_close_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucol_strcoll_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_setSubstChars_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_fromUnicode_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_getAvailableName_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_getAlias_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucol_getSortKey_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_getMaxCharSize_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `ucnv_open_49'
/other/Qt5.0.1/5.0.1/gcc_64/lib/libQt5Core.so.5: undefined reference to `u_errorName_49'
collect2: ld returned 1 exit status
make[1]: *** [bin/visual_route_generationmap_markup_gui] Error 1
make[1]: Leaving directory `/lucid/other/workspace/perception/visual_route_generation/map_markup_gui'
make: *** [release-all] Error 2
==================================================================================
Its still trying to use QT5 libraries. I have removed all the set variables from .bashrc.
How do I make the pro files look only for qt4 libs ?