I have been trying to link with libjsoncpp on Ubuntu 16.04 but keep on getting the same error, even after reinstalling all json libraries in the system.
undefined reference to `Json::Value::getMemberNames() const'
undefined reference to `Json::Value::operator[](std::string const&)'
undefined reference to `Json::Value::asString() const'
collect2: error: ld returned 1 exit status
This code use to compile out-of-the-box with libjsoncpp in Ubuntu 14.04
locate libjsoncpp gives me this:
/usr/lib/x86_64-linux-gnu/libjsoncpp.a
/usr/lib/x86_64-linux-gnu/libjsoncpp.so
/usr/lib/x86_64-linux-gnu/libjsoncpp.so.1
/usr/lib/x86_64-linux-gnu/libjsoncpp.so.1.7.2
Any ideas?
Related
I'm trying to sun OpenGL SuperBible 6th edition example code for the first time on my Manjaro (arch) system.
I followed the HOWTOBUILD.txt, installed mesa and glfw (glfw-wayland, not sure if there is a difference) via pacman. Tried to run the first time unsuccessfuly, then changed an error in the CMakeList.txt as described in here https://stackoverflow.com/a/24474361/9197461
it got rid of the undefined reference to 'glfwInit' error, but all other undefined errors stayed. Can anyone help me compile this without errors?
code example:
https://github.com/openglsuperbible/sb6code
full error when I try to run make:
/usr/bin/ld: CMakeFiles/wrapmodes.dir/src/wrapmodes/wrapmodes.cpp.o: in function `sb6::application::run(sb6::application*)':
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x8b): undefined reference to `glfwOpenWindowHint'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xa1): undefined reference to `glfwOpenWindowHint'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xb0): undefined reference to `glfwOpenWindowHint'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xbf): undefined reference to `glfwOpenWindowHint'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xd5): undefined reference to `glfwOpenWindowHint'
/usr/bin/ld: CMakeFiles/wrapmodes.dir/src/wrapmodes/wrapmodes.cpp.o:wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xf5): more undefined references to `glfwOpenWindowHint' follow
/usr/bin/ld: CMakeFiles/wrapmodes.dir/src/wrapmodes/wrapmodes.cpp.o: in function `sb6::application::run(sb6::application*)':
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x133): undefined reference to `glfwGetDesktopMode'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x18b): undefined reference to `glfwOpenWindow'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1e9): undefined reference to `glfwOpenWindow'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x25b): undefined reference to `glfwSetMousePosCallback'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x267): undefined reference to `glfwSetMouseWheelCallback'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x280): undefined reference to `glfwEnable'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x289): undefined reference to `glfwDisable'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x29a): undefined reference to `glfwGetWindowParam'
/usr/bin/ld: wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3bc): undefined reference to `glfwGetWindowParam'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/wrapmodes.dir/build.make:105: bin/wrapmodes] Error 1
make[1]: *** [CMakeFiles/Makefile2:296: CMakeFiles/wrapmodes.dir/all] Error 2
make: *** [Makefile:104: all] Error 2
I downloaded the source code and tried the steps you've done and not surpringsingly, received the same error message.
And it seems that the source code uses GLFW2 instead of GLFW3.
glfwOpenWindowHint is renamed to glfwWindowHint in GLFW3
See: glfwOpenWindowHint not declared in this scope GLFW3 & GLEW
You could try installing GLFW2 and run it again. Since GLFW2 is available in Ubuntu Xenial, remember to configure sources.list accordingly.
For OpenGL SuperBible 6th
EDIT:
I could not manage to install libglfw2 from Ubuntu Xenial repository. And manually installed dpkg from official website.
download .deb file from https://launchpad.net/ubuntu/xenial/+package/libglfw-dev
go to the folder .deb is installed in and run sudo dpkg -i [name of libglfw2].deb
Run find . -name "libglfw*" in /usr/lib to find the path to the library. (there can be multiple libglfw.so as you already downloaded GLFW3 so be careful)
Create a symbolic link for the dynamic library just installed by running the following command:
sudo ln -s /usr/lib/[path to file]/[filename] /usr/lib/[path to file]/libglfw2.so
Edit sb6code/CMakeFiles/tunnel.dir/link.txt as follows
-lglfw to -lglfw2
Run make
For OpenGL SuperBible 7th
If you have already installed libglfw3 but could not manage to run cmake .., this could be because your libglfw3.so is stored as libglfw.so.
In that case, you can create a symbolic link to it:
sudo ln -s /usr/lib/[path to file]/[libglfw name].so /usr/lib/[path to file]/libglfw3.so
Save and run cmake .. again inside build.
If it fails because of linker, make sure you have all the dependencies:
libglfw3-dev libx11-dev libxrandr-dev libxinerama-dev libxi-dev libxxf86vm-dev libxcursor-dev
I am using gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf on my ubuntu system using NetBeans IDE. My cross compiler is having libc-2.21 where as some of the libraries requires libc-2.28.And my target machine(debian jessie) do have libc-2.28 .
How can I upgrade it?
This is the error message I am getting after compiling in Netbeans:
/opt/crosstool/arm-linux-gnueabihf/bin/../arm-linux-gnueabihf/libc/usr/lib/libavutil.so.56: undefined reference to 'fcntl64#GLIBC_2.28'
/opt/crosstool/arm-linux-gnueabihf/bin/../arm-linux-gnueabihf/libc/usr/lib/libsystemd.so.0: undefined reference to 'getrandom#GLIBC_2.25'
/opt/crosstool/arm-linux-gnueabihf/bin/../arm-linux-gnueabihf/libc/usr/lib/libbellesip.so.0: undefined reference to 'fcntl#GLIBC_2.28'
/opt/crosstool/arm-linux-gnueabihf/bin/../arm-linux-gnueabihf/libc/usr/lib/libavcodec.so.58: undefined reference to 'powf#GLIBC_2.27'
/opt/crosstool/arm-linux-gnueabihf/bin/../arm-linux-gnueabihf/libc/usr/lib/libsystemd.so.0: undefined reference to 'reallocarray#GLIBC_2.26'
/opt/crosstool/arm-linux-gnueabihf/bin/../arm-linux-gnueabihf/libc/usr/lib/libmediastreamer_voip.so.10: undefined reference to 'expf#GLIBC_2.27'
/opt/crosstool/arm-linux-gnueabihf/bin/../arm-linux-gnueabihf/libc/usr/lib/libpulsecommon-12.2.so: undefined reference to 'memfd_create#GLIBC_2.27'
/opt/crosstool/arm-linux-gnueabihf/bin/../arm-linux-gnueabihf/libc/usr/lib/libavcodec.so.58: undefined reference to 'exp2f#GLIBC_2.27'
/opt/crosstool/arm-linux-gnueabihf/bin/../arm-linux-gnueabihf/libc/usr/lib/libavcodec.so.58: undefined reference to 'log2f#GLIBC_2.27'
/opt/crosstool/arm-linux-gnueabihf/bin/../arm-linux-gnueabihf/libc/usr/lib/libortp.so.13: undefined reference to 'logf#GLIBC_2.27'
collect2: error: ld returned 1 exit status
When attempting to compile synergy 1.4.16 on a Mint 17.1 (Rebecca) I get the following error:
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::newMutex()':
CArchMultithreadPosix.cpp:(.text+0x319): undefined reference to `pthread_mutexattr_init'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::raiseSignal(IArchMultithread::ESignal)':
CArchMultithreadPosix.cpp:(.text+0x43b): undefined reference to `pthread_kill'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::threadSignalHandler(void*)':
CArchMultithreadPosix.cpp:(.text+0x490): undefined reference to `pthread_detach'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::closeThread(CArchThreadImpl*)':
CArchMultithreadPosix.cpp:(.text+0x62b): undefined reference to `pthread_detach'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::newThread(void* (*)(void*), void*)':
CArchMultithreadPosix.cpp:(.text+0x8e6): undefined reference to `pthread_sigmask'
CArchMultithreadPosix.cpp:(.text+0x90f): undefined reference to `pthread_sigmask'
CArchMultithreadPosix.cpp:(.text+0x935): undefined reference to `pthread_create'
CArchMultithreadPosix.cpp:(.text+0x9a4): undefined reference to `pthread_create'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::CArchMultithreadPosix()':
CArchMultithreadPosix.cpp:(.text+0xe11): undefined reference to `pthread_mutexattr_init'
CArchMultithreadPosix.cpp:(.text+0xf05): undefined reference to `pthread_sigmask'
CArchMultithreadPosix.cpp:(.text+0xf26): undefined reference to `pthread_sigmask'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::startSignalHandler()':
CArchMultithreadPosix.cpp:(.text+0x10a8): undefined reference to `pthread_sigmask'
CArchMultithreadPosix.cpp:(.text+0x10cd): undefined reference to `pthread_sigmask'
CArchMultithreadPosix.cpp:(.text+0x1104): undefined reference to `pthread_create'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::cancelThread(CArchThreadImpl*)':
CArchMultithreadPosix.cpp:(.text+0x5e3): undefined reference to `pthread_kill'
collect2: error: ld returned 1 exit status
make[2]: *** [../../bin/synergyd] Error 1
make[1]: *** [src/cmd/synergyd/CMakeFiles/synergyd.dir/all] Error 2
make: *** [all] Error 2
Going back to: /home/jussi/Downloads/synergy-1.4.16/synergy-1.4.16-Source
Error: make failed: 512
I already tried the solution to the identical problem here but the solution of adding pthreadto the end of target_link_libraries on src/cmd/synergyd/CMakeLists.txt does not resolve my issue, it remains the same.
The only reason I'm not using pre-compiled packages is that I need to use synergy with my Raspberry Pi 3 and the packages available through the packge repos have incompatible synergy protocols - 1.4.16 on Pi vs 1.4.12 on Mint 17.1 so an alternative solution to have compatible protocols on each of the machines will also be sufficient.
Setting CMAKE_CXX_FLAGS after project definition in CMakeList.txt made it to work for me:
First, declare project (important for prerequisite checks).
project(synergy C CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03 -pthread")
Identified an alternative solution: I worked my way around this by (ab?)using the fact that the synergy server with higher protocol version seems to be backwards-compatible with older protocol versions, so I compiled the version 1.8.something and the client on my Pi with 1.4.16 is happy to connect and I can now share the keyboard and mouse connected to my Mint with the Pi.
I Followed the guide for unix. http://www.boost.org/doc/libs/1_51_0/more/getting_started/unix-variants.html. It works fine on my mac. But on my VPS I seem to be having a few issues. I downloaded the latest build and ran bootstrap and b2 install and the example.cpp worked fine.
When I tired to compile the boost udp echo server - http://www.boost.org/doc/libs/1_38_0/doc/html/boost_asio/example/echo/async_udp_echo_server.cpp
I get following error.
andrew#am:~/Documents/boostExamples/asyncUdpEchoServer$ c++ -I /usr/local/boost main.cpp -o udpEchoServer
/tmp/cczYAR1r.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text+0x21e): undefined reference to `boost::system::generic_category()'
main.cpp:(.text+0x228): undefined reference to `boost::system::generic_category()'
main.cpp:(.text+0x232): undefined reference to `boost::system::system_category()'
/tmp/cczYAR1r.o: In function `boost::system::error_code::error_code()':
main.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x10): undefined reference to `boost::system::system_category()'
/tmp/cczYAR1r.o: In function `boost::asio::error::get_system_category()':
main.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x7): undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
Any ideas what I need to do here? - I was sort if under the influence that you don't need to build boost.
The vps is running ubuntu server 11.10 but it seems to be a little cut down. I have installed build-essential.
You must link boost_system lib: -lboost_system. Also dont forget to specify lib directory if need.
I am trying to use mongodb for the first time in c++. I just installed the latest version on Ubuntu and also installed the lastest v2.0 c++ driver code. It compiled just fine using scons. In the c++ file the below is my include.
#include <client/dbclient.h>
So..I am assuming I have to make a ref to a boost library but I don't know how to do it.
make all
Building target: rtb
Invoking: GCC C++ Linker
g++ -L/usr/local/include/ -L/home/boost -L/home/cpp/mongo-cxx-driver-v2.0/mongo -lfcgi++ -o"rtb" ./src/rtb.o
./src/rtb.o: In function `__static_initialization_and_destruction_0':
/home/boost/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/home/boost/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/home/boost/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
make: *** [rtb] Error 1
Add -lboost_system to your link line.