I am writing a project in C++ and utilizing conan + cmake to manage the dependencies.. I just now started looking to upgrade to latest versions of my client and thrift dependency (v0.13 to v0.15) but it suddenly complains at the linking stage...
tried adding thriftnb , CONAN_PKG::thriftnb, event ... but nothing seems to change
-- Conan: Adjusting output directories
-- Conan: Using cmake targets configuration
-- Library thriftz found /home/emcp/.conan/data/thrift/0.13.0/_/_/package/44b3a17b9712eb98c7cab65c26ec70335992ff20/lib/libthriftz.a
-- Library thriftnb found /home/emcp/.conan/data/thrift/0.13.0/_/_/package/44b3a17b9712eb98c7cab65c26ec70335992ff20/lib/libthriftnb.a
-- Library thrift found /home/emcp/.conan/data/thrift/0.13.0/_/_/package/44b3a17b9712eb98c7cab65c26ec70335992ff20/lib/libthrift.a
-- Library twsapi found /home/emcp/.conan/data/ibsapi/10.10.01/bonks/prod/package/2a30b7d6ea2202e5393ebda51c8729dd2162b9f8/lib/libtwsapi.a
-- Library boost_contract found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_contract.a
-- Library boost_coroutine found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_coroutine.a
-- Library boost_fiber_numa found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_fiber_numa.a
-- Library boost_fiber found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_fiber.a
-- Library boost_context found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_context.a
-- Library boost_graph found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_graph.a
-- Library boost_iostreams found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_iostreams.a
-- Library boost_json found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_json.a
-- Library boost_locale found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_locale.a
-- Library boost_log_setup found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_log_setup.a
-- Library boost_log found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_log.a
-- Library boost_math_c99 found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_math_c99.a
-- Library boost_math_c99f found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_math_c99f.a
-- Library boost_math_c99l found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_math_c99l.a
-- Library boost_math_tr1 found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_math_tr1.a
-- Library boost_math_tr1f found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_math_tr1f.a
-- Library boost_math_tr1l found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_math_tr1l.a
-- Library boost_nowide found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_nowide.a
-- Library boost_program_options found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_program_options.a
-- Library boost_random found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_random.a
-- Library boost_regex found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_regex.a
-- Library boost_stacktrace_addr2line found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_stacktrace_addr2line.a
-- Library boost_stacktrace_backtrace found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_stacktrace_backtrace.a
-- Library boost_stacktrace_basic found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_stacktrace_basic.a
-- Library boost_stacktrace_noop found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_stacktrace_noop.a
-- Library boost_timer found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_timer.a
-- Library boost_type_erasure found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_type_erasure.a
-- Library boost_thread found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_thread.a
-- Library boost_chrono found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_chrono.a
-- Library boost_container found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_container.a
-- Library boost_date_time found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_date_time.a
-- Library boost_unit_test_framework found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_unit_test_framework.a
-- Library boost_prg_exec_monitor found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_prg_exec_monitor.a
-- Library boost_test_exec_monitor found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_test_exec_monitor.a
-- Library boost_exception found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_exception.a
-- Library boost_wave found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_wave.a
-- Library boost_filesystem found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_filesystem.a
-- Library boost_atomic found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_atomic.a
-- Library boost_wserialization found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_wserialization.a
-- Library boost_serialization found /home/emcp/.conan/data/boost/1.78.0/_/_/package/adf48b8e4446dcb68f440fe42ff08878d5c7feed/lib/libboost_serialization.a
-- Library event_extra found /home/emcp/.conan/data/libevent/2.1.12/_/_/package/6b0981c427aa0eb8bea05add2094df29ed639799/lib/libevent_extra.a
-- Library event_openssl found /home/emcp/.conan/data/libevent/2.1.12/_/_/package/6b0981c427aa0eb8bea05add2094df29ed639799/lib/libevent_openssl.a
-- Library event_pthreads found /home/emcp/.conan/data/libevent/2.1.12/_/_/package/6b0981c427aa0eb8bea05add2094df29ed639799/lib/libevent_pthreads.a
-- Library event_core found /home/emcp/.conan/data/libevent/2.1.12/_/_/package/6b0981c427aa0eb8bea05add2094df29ed639799/lib/libevent_core.a
-- Library z found /home/emcp/.conan/data/zlib/1.2.11/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709/lib/libz.a
-- Library bz2 found /home/emcp/.conan/data/bzip2/1.0.8/_/_/package/da606cf731e334010b0bf6e85a2a6f891b9f36b0/lib/libbz2.a
-- Library backtrace found /home/emcp/.conan/data/libbacktrace/cci.20210118/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709/lib/libbacktrace.a
-- Library ssl found /home/emcp/.conan/data/openssl/1.1.1m/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709/lib/libssl.a
-- Library crypto found /home/emcp/.conan/data/openssl/1.1.1m/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709/lib/libcrypto.a
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: /ibs-api-thrift/servers/cpp_server/build_cmake
-- Conan: Compiler GCC>=5, checking major version 9
-- Conan: Checking correct version: 9
-- Configuring done
-- Generating done
-- Build files have been written to: /ibsapi-thrift/servers/cpp_server/build_cmake
...
[100%] Linking CXX executable bin/jokers_server
/usr/bin/ld: CMakeFiles/jokers_server.dir/src/gen-cpp/jokers.cpp.o: in function `ibsapithrift::jokersConcurrentClient::recv_connect(int)':
jokers.cpp:(.text+0x63f8): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::updatePending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, apache::thrift::protocol::TMessageType, int)'
/usr/bin/ld: jokers.cpp:(.text+0x6416): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::getPending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, apache::thrift::protocol::TMessageType&, int&)'
/usr/bin/ld: CMakeFiles/jokers_server.dir/src/gen-cpp/jokers.cpp.o: in function `ibsapithrift::jokersConcurrentClient::recv_disconnect(int)':
jokers.cpp:(.text+0x6968): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::updatePending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, apache::thrift::protocol::TMessageType, int)'
/usr/bin/ld: jokers.cpp:(.text+0x6986): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::getPending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, apache::thrift::protocol::TMessageType&, int&)'
/usr/bin/ld: CMakeFiles/jokers_server.dir/src/gen-cpp/jokers.cpp.o: in function `ibsapithrift::jokersConcurrentClient::recv_ping(int)':
jokers.cpp:(.text+0x6ed8): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::updatePending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, apache::thrift::protocol::TMessageType, int)'
/usr/bin/ld: jokers.cpp:(.text+0x6ef6): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::getPending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, apache::thrift::protocol::TMessageType&, int&)'
/usr/bin/ld: CMakeFiles/jokers_server.dir/src/gen-cpp/jokers.cpp.o: in function `ibsapithrift::jokersConcurrentClient::recv_ib_status(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, int)':
jokers.cpp:(.text+0xa098): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::updatePending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, apache::thrift::protocol::TMessageType, int)'
/usr/bin/ld: jokers.cpp:(.text+0xa0b6): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::getPending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, apache::thrift::protocol::TMessageType&, int&)'
/usr/bin/ld: CMakeFiles/jokers_server.dir/src/gen-cpp/jokers.cpp.o: in function `ibsapithrift::jokersConcurrentClient::recv_request_news(std::vector<ibsapithrift::NewsResponse, std::allocator<ibsapithrift::NewsResponse> >&, int)':
jokers.cpp:(.text+0xd378): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::updatePending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, apache::thrift::protocol::TMessageType, int)'
/usr/bin/ld: jokers.cpp:(.text+0xd396): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::getPending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, apache::thrift::protocol::TMessageType&, int&)'
/usr/bin/ld: CMakeFiles/jokers_server.dir/src/gen-cpp/jokers.cpp.o: in function `ibsapithrift::jokersConcurrentClient::recv_request_historical(std::vector<ibsapithrift::HistoricalResponse, std::allocator<ibsapithrift::HistoricalResponse> >&, int)':
jokers.cpp:(.text+0xe4f8): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::updatePending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, apache::thrift::protocol::TMessageType, int)'
/usr/bin/ld: jokers.cpp:(.text+0xe516): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::getPending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, apache::thrift::protocol::TMessageType&, int&)'
/usr/bin/ld: CMakeFiles/jokers_server.dir/src/gen-cpp/jokers.cpp.o: in function `ibsapithrift::jokersConcurrentClient::recv_request_matching_symbols(std::vector<ibsapithrift::MatchingSymbolResponse, std::allocator<ibsapithrift::MatchingSymbolResponse> >&, int)':
jokers.cpp:(.text+0xf678): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::updatePending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, apache::thrift::protocol::TMessageType, int)'
/usr/bin/ld: jokers.cpp:(.text+0xf696): undefined reference to `apache::thrift::async::TConcurrentClientSyncInfo::getPending(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, apache::thrift::protocol::TMessageType&, int&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/jokers_server.dir/build.make:212: bin/jokers_server] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/jokers_server.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
chmod: cannot access 'jokers_server': No such file or directory
My CMakeLists.txt
cmake_minimum_required(VERSION 2.8.12)
project(jokers_server)
add_compile_options(-std=c++17)
# Using the "cmake" generator
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
FILE ( GLOB THRIFT_GEN_SRC src/gen-cpp/*.cpp )
FILE ( GLOB IBS_API_SRC src/ibs-client/*.cpp )
add_executable(jokers_server src/jokers_server.cpp src/threadsafe_stack.cpp ${THRIFT_GEN_SRC} ${IBS_API_SRC} )
target_link_libraries(jokers_server pthread CONAN_PKG::thrift CONAN_PKG::ibsapi)`
I did some digging that I might need to add lib event.. which conan had picked up in the dependencies but.. adding CONAN_PKG::libevent did nothing
EDIT: In the thrift documentation
https://github.com/apache/thrift/tree/master/lib/cpp#linking-against-thrift-1
You need to link your project that uses thrift against all the thrift
dependencies; in the case of libthrift, openssl, pthreads, and librt
and for libthriftnb, libevent.
In the project properties you must also set HAVE_CONFIG_H as force
include the config header: "windows/config.h"
any clue if I am needing to add something ? this was all working last time i built the project .. so I must have missed some dev tools locally that my previous machine had?
turned out.. by default conan doesn't do the new ABI.. so when I built it last, I'd had to set the default behavior.. and you can do this by the following command.. once i did this and rebuilt my ibs-api conan recipe.. and built thrift .. everything worked 100%
conan profile update settings.compiler.libcxx=libstdc++11 <MY_DEFAULT_PROFILE>
Related
I am unable to connect Mapnik via cmake to my application.
I tried to do like this:
cmake_minimum_required(VERSION 3.1)
project(MapnikTest)
set(MAPNIK_LIB "/usr/local/lib/libmapnik.so.3.1.0") dont work
#set(MAPNIK_LIB "/usr/local/lib/libmapnik.so") dont work
set(MAPNIK_INCLUDE_DIR "/usr/local/include/mapnik") work
#find_package(mapnik REQUIRED) dont work
#find_package(Mapnik REQUIRED) dont work
include_directories(${MAPNIK_INCLUDE_DIR})
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE ${MAPNIK_LIB})
The thing is, I don't have mapnikConfig.cmake in /usr/local/bin/cmake
Can't connect the library directly. Include he sees.
I edited already LD_LIBRARY_PATH it didn't help either.
/usr/bin/ld: CMakeFiles/MapnikTest.dir/main.cpp.o: in function `main':
main.cpp:(.text+0x3b): undefined reference to `mapnik::Map::Map(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: main.cpp:(.text+0xb8): undefined reference to `mapnik::load_map(mapnik::Map&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: main.cpp:(.text+0x1b9): undefined reference to `void mapnik::save_to_file<mapnik::image<mapnik::rgba8_t> >(mapnik::image<mapnik::rgba8_t> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: CMakeFiles/MapnikTest.dir/main.cpp.o: in function `icu_66::UnicodeString::hashCode() const':
main.cpp:(.text._ZNK6icu_6613UnicodeString8hashCodeEv[_ZNK6icu_6613UnicodeString8hashCodeEv]+0x18): undefined reference to `icu_66::UnicodeString::doHashCode() const'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/MapnikTest.dir/build.make:104: MapnikTest] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/MapnikTest.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
(dont work mean this)
Find where you have mapnikConfig.cmake or mapnik-config.cmake and set mapnik_DIR to it. Like this:
cmake -Dmapnik_DIR="/path/to/config" ..
and it should be
find_package(mapnik REQUIRED)
Edit
When I inspect github more carefully it turn out that cmake config was introduced recently, after last release. So my answer will become valid for next release of this library.
You can inspect this change to see how import that library.
Original (valid after next release 3.2):
Based on demo form Mapnik repo it should go like this:
cmake_minimum_required(VERSION 3.1)
project(MapnikTest)
find_package(mapnik REQUIRED)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE mapnik::agg mapnik::mapnik)
Didn't test it, but should work. I can see library provides proper config.
I have used boost/json inside my C++ project which I have created under windows. There the dependency was installed with vcpkg (vcpkg.exe install boost-json). Now I want to port this project to Ubuntu. But I have no clue how to install the library under Linux. Probably this is obvious to a C++ veteran but I couldn't get it to work. I can't find any hints in the git project or on the official website.
I have already tried:
using CMake to build and install the library
including the code via add_library in my CMakeLists.txt
Using it as header-only by copying only the include folder
What is the best practice to include such a library in a project and what are the steps to achieve it? Is there a tutorial for such tasks? My biggest problem is, I don`t know what to google for.
I hope someone can help me, thank you in advance.
EDIT:
As proposed by #vre, I built boost 1.78.0 from source. CMake finds now the boost version with version 1.78.0 and the include error is gone. Nevertheless it is still not working as the linking under Linux is failing. The following output I get:
/usr/bin/ld: CMakeFiles/Server.dir/main.cpp.o: in function `parse_server_config_json(std::filesystem::__cxx11::path)':
main.cpp:(.text+0x511): undefined reference to `boost::json::parse(boost::basic_string_view<char, std::char_traits<char> >, boost::json::storage_ptr, boost::json::parse_options const&)'
/usr/bin/ld: main.cpp:(.text+0x544): undefined reference to `boost::json::value::~value()'
/usr/bin/ld: main.cpp:(.text+0x589): undefined reference to `boost::json::object::operator[](boost::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: main.cpp:(.text+0x5d0): undefined reference to `boost::json::object::operator[](boost::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: main.cpp:(.text+0x615): undefined reference to `boost::json::object::operator[](boost::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: main.cpp:(.text+0x662): undefined reference to `boost::json::object::operator[](boost::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: main.cpp:(.text+0x6af): undefined reference to `boost::json::object::operator[](boost::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: CMakeFiles/Server.dir/main.cpp.o:main.cpp:(.text+0x758): more undefined references to `boost::json::object::operator[](boost::basic_string_view<char, std::char_traits<char> >)' follow
/usr/bin/ld: CMakeFiles/Server.dir/main.cpp.o: in function `parse_server_config_json(std::filesystem::__cxx11::path)':
main.cpp:(.text+0xb46): undefined reference to `boost::json::object::~object()'
/usr/bin/ld: main.cpp:(.text+0xbb4): undefined reference to `boost::json::value::~value()'
/usr/bin/ld: main.cpp:(.text+0xd4f): undefined reference to `boost::json::object::~object()'
/usr/bin/ld: CMakeFiles/Server.dir/main.cpp.o: in function `boost::json::object::object(boost::json::object const&)':
main.cpp:(.text._ZN5boost4json6objectC2ERKS1_[_ZN5boost4json6objectC5ERKS1_]+0x4a): undefined reference to `boost::json::object::object(boost::json::object const&, boost::json::storage_ptr)'
/usr/bin/ld: CMakeFiles/Server.dir/main.cpp.o: in function `boost::json::value::as_object()':
main.cpp:(.text._ZN5boost4json5value9as_objectEv[_ZN5boost4json5value9as_objectEv]+0x66): undefined reference to `boost::json::detail::throw_invalid_argument(char const*, boost::source_location const&)'
/usr/bin/ld: CMakeFiles/Server.dir/main.cpp.o: in function `boost::json::value::as_array()':
main.cpp:(.text._ZN5boost4json5value8as_arrayEv[_ZN5boost4json5value8as_arrayEv]+0x66): undefined reference to `boost::json::detail::throw_invalid_argument(char const*, boost::source_location const&)'
/usr/bin/ld: CMakeFiles/Server.dir/main.cpp.o: in function `boost::json::value::as_string() const':
main.cpp:(.text._ZNK5boost4json5value9as_stringEv[_ZNK5boost4json5value9as_stringEv]+0x66): undefined reference to `boost::json::detail::throw_invalid_argument(char const*, boost::source_location const&)'
/usr/bin/ld: CMakeFiles/Server.dir/main.cpp.o: in function `boost::json::value::as_int64()':
main.cpp:(.text._ZN5boost4json5value8as_int64Ev[_ZN5boost4json5value8as_int64Ev]+0x66): undefined reference to `boost::json::detail::throw_invalid_argument(char const*, boost::source_location const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/Server.dir/build.make:102: Server] Error 1
make[1]: *** [CMakeFiles/Makefile2:140: CMakeFiles/Server.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
I also added as mentioned by #GP8:
find_package(
Boost 1.78 REQUIRED
COMPONENTS json
)
Edit2:
I forgot to link boost-json. After adding the following to my CMakeLists.txt the build was successfull under linux:
target_link_libraries(${PROJECT_NAME}
Boost::boost
Boost::json
)
You should first install boost using the following command : sudo apt-get install libboost-all-dev
To get Boost libraries included in your project you must find the package this way :
find_package(
Boost 1.65 REQUIRED
COMPONENTS json
)
You can then, tell CMake to with which file to create your executable and against which libraries to link :
add_execublable( anyExecutable main.cpp )
target_link_libraries( exeLINK_PUBLIC ${Boost_LIBRARIES})
#GPB outlines the general procedure.
If your CMake/FindBoost doesn't support Boost Json yet, the simplest thing to do is to
#include <boost/json/src.hpp>
in exactly 1 (one) translation unit that participates in your linked binary.
See Header Only
I want to add the library ixwebsocket my project. Following the instructions of the library I get the libixwebsocket.a (the compiled static library, correct me if I am wrong).
How I can use this .a file in my project?
For testing I have created the following program: main.cpp
#CMakeLists.txt
cmake_minimum_required(VERSION 3.0.0)
project(cpptest VERSION 0.1.0)
include(CTest)
enable_testing()
add_executable(cpptest main.cpp)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
target_link_libraries(cpptest "${CMAKE_SOURCE_DIR}/libixwebsocket.a")
//main.cpp
#include <iostream>
#include <ixwebsocket/IXNetSystem.h>
#include <ixwebsocket/IXWebSocket.h>
int main(int, char**) {
std::cout << "Hello, world!\n";
ix::WebSocket webSocket;
}
In the directory I have CMakeLists.txt, libixwebsocket.a and main.cpp.
I get a long list of undefined reference errors, the firsts ones:
[build] [ 50%] Linking CXX executable cpptest
[build] /usr/bin/ld: ../libixwebsocket.a(IXWebSocket.cpp.o): in function `ix::WebSocket::start()':
[build] IXWebSocket.cpp:(.text+0x2240): undefined reference to `pthread_create'
ld] /usr/bin/ld: ../libixwebsocket.a(IXWebSocket.cpp.o): in function `ix::WebSocket::checkConnection(bool)':
[build] IXWebSocket.cpp:(.text+0x5b8d): undefined reference to `pthread_cond_clockwait'
[build] /usr/bin/ld: ../libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): in function `bool ix::WebSocketPerMessageDeflateCompressor::compressData<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) [clone .part.0]':
[build] IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x67): undefined reference to `deflate'
[build] /usr/bin/ld: ../libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): in function `ix::WebSocketPerMessageDeflateCompressor::~WebSocketPerMessageDeflateCompressor()':
[build] IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x35c): undefined reference to `deflateEnd'
[build] /usr/bin/ld: ../libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): in function `ix::WebSocketPerMessageDeflateCompressor::init(unsigned char, bool)':
[build] IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x3a6): undefined reference to `deflateInit2_'
[build] /usr/bin/ld: ../libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): in function `ix::WebSocketPerMessageDeflateDecompressor::~WebSocketPerMessageDeflateDecompressor()':
[build] IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x64c): undefined reference to `inflateEnd'
[build] /usr/bin/ld: ../libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): in function `ix::WebSocketPerMessageDeflateDecompressor::init(unsigned char, bool)':
[build] IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x685): undefined reference to `inflateInit2_'
[build] /usr/bin/ld: ../libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): in function `ix::WebSocketPerMessageDeflateDecompressor::decompress(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
[build] IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x7d6): undefined reference to `inflate'
[build] /usr/bin/ld: ../libixwebsocket.a(IXWebSocketPerMessageDeflateCodec.cpp.o): in function `bool ix::WebSocketPerMessageDeflateCompressor::compressData<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned char, std::allocator<unsigned char> >&) [clone .part.0]':
[build] IXWebSocketPerMessageDeflateCodec.cpp:(.text+0x90d): undefined reference to `deflate'
[build] /usr/bin/ld: ../libixwebsocket.a(IXSocketOpenSSL.cpp.o): in function `ix::SocketOpenSSL::openSSLInitialize()':
[build] IXSocketOpenSSL.cpp:(.text+0x1c): undefined reference to `OPENSSL_init_ssl'
[build] /usr/bin/ld: IXSocketOpenSSL.cpp:(.text+0x29): undefined reference to `OPENSSL_init_ssl'
How may these undefined refrence errors be resolved?
Thanks in advance!
It would be always best to use find_package() calls. This way you ensure that the library is indeed installed on your system, or is exported in the build tree.
If you have the library installed on your system you can use this call, like this:
find_package(ixwebsocket REQUIRED)
target_link_libraries(cpptest ixwebsocket::ixwebsocket)
In your case, since the library is compiled independently (and it is not a target in your tree), you need to use find_library(IXWEBSOCKET_LIB ixwebsocket) and specify additional hints/names if you have the library in your own location, following the docs.
I ran into a similar issue today, the library was linking just fine but a static lib is just a collection of .o files and has no understanding of it's own dependencies...
This command worked for me:
g++ -o output/myapp -std=c++17 myapp.cpp -Llib -framework CoreFoundation -framework Security -lmylib
I'm no expert in CMake but this answer seems to indicate that the below would achieve the same effect
target_link_libraries(program "-framework CoreFoundation" "-framework Security")
So if we apply it to your case:
#CMakeLists.txt
cmake_minimum_required(VERSION 3.0.0)
project(cpptest VERSION 0.1.0)
include(CTest)
enable_testing()
add_executable(cpptest main.cpp)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
target_link_libraries(cpptest "${CMAKE_SOURCE_DIR}/libixwebsocket.a" "-framework CoreFoundation")
I've got a feeling pthread_create is likely to live in CoreFoundation but I'm just guessing... You may need to try a few frameworks to find the right one.
Hope this helps a little :)
I want to connect to mysql 8 using mysql-c++-connector8 (xdevapi) and I use .so file for linking but I get errors
here is my main.cpp file
#include <iostream>
#include <mysqlx/xdevapi.h>
using namespace ::mysqlx;
using std::cout;
using std::cin;
using std::endl;
int main(){
Session sess("localhost",3306,"root","mypass");
Schema db = sess.getSchema("university");
Collection myColl = db.getCollection("student");
DocResult myDocs = myColl.find("name like :param").execute();
cout<<myDocs.fetchOne();
}
CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(1)
set(CMAKE_CXX_STANDARD 17)
include_directories(~/mysql-connector-c++/include)
link_directories(~/mysql-connector-c++/lib64)
set(PROJECT_LINK_LIBS libmysqlcppconn8.so)
add_executable(myExe main.cpp)
target_link_libraries(myExe ${PROJECT_LINK_LIBS})
Errors:
[ 50%] Linking CXX executable myExe
/usr/bin/ld: CMakeFiles/myExe.dir/main.cpp.o: in function `mysqlx::string::string(char const*)':
/home/amir/mysql-connector-c++/include/mysqlx/devapi/common.h:100: undefined reference to `mysqlx::string::Impl::from_utf8(mysqlx::string&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: CMakeFiles/myExe.dir/main.cpp.o: in function `mysqlx::string::string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/amir/mysql-connector-c++/include/mysqlx/devapi/common.h:105: undefined reference to `mysqlx::string::Impl::from_utf8(mysqlx::string&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: CMakeFiles/myExe.dir/main.cpp.o: in function `mysqlx::string::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const':
/home/amir/mysql-connector-c++/include/mysqlx/devapi/common.h:115: undefined reference to `mysqlx::string::Impl::to_utf8[abi:cxx11](mysqlx::string const&)'
/usr/bin/ld: CMakeFiles/myExe.dir/main.cpp.o: in function `void mysqlx::internal::Settings_detail<mysqlx::internal::Settings_traits>::set<true, mysqlx::SessionOption, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mysqlx::SessionOption, unsigned int&, mysqlx::SessionOption, mysqlx::string const&>(mysqlx::SessionOption, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mysqlx::SessionOption&&, unsigned int&, mysqlx::SessionOption&&, mysqlx::string const&)':
/home/amir/mysql-connector-c++/include/mysqlx/devapi/detail/settings.h:67: undefined reference to `mysqlx::internal::Settings_detail<mysqlx::internal::Settings_traits>::do_set(std::__cxx11::list<std::pair<int, mysqlx::common::Value>, std::allocator<std::pair<int, mysqlx::common::Value> > >&&)'
/usr/bin/ld: CMakeFiles/myExe.dir/main.cpp.o: in function `void mysqlx::internal::Settings_detail<mysqlx::internal::Settings_traits>::set<true, mysqlx::SessionOption, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(mysqlx::SessionOption, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)':
/home/amir/mysql-connector-c++/include/mysqlx/devapi/detail/settings.h:67: undefined reference to `mysqlx::internal::Settings_detail<mysqlx::internal::Settings_traits>::do_set(std::__cxx11::list<std::pair<int, mysqlx::common::Value>, std::allocator<std::pair<int, mysqlx::common::Value> > >&&)'
/usr/bin/ld: CMakeFiles/myExe.dir/main.cpp.o: in function `void mysqlx::internal::Settings_detail<mysqlx::internal::Settings_traits>::set<true, mysqlx::SessionOption, mysqlx::string const&>(mysqlx::SessionOption, mysqlx::string const&)':
/home/amir/mysql-connector-c++/include/mysqlx/devapi/detail/settings.h:67: undefined reference to `mysqlx::internal::Settings_detail<mysqlx::internal::Settings_traits>::do_set(std::__cxx11::list<std::pair<int, mysqlx::common::Value>, std::allocator<std::pair<int, mysqlx::common::Value> > >&&)'
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/myExe.dir/build.make:95: myExe] Error 1
make[2]: *** [CMakeFiles/Makefile2:68: CMakeFiles/myExe.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:80: CMakeFiles/myExe.dir/rule] Error 2
make: *** [Makefile:118: myExe] Error 2
I don't want to use legacy connectors as it is not recommended .
TL;DR; You need to use the old GCC ABI by setting the _GLIBCXX_USE_CXX11_ABI to 0. This can be done with cmake by adding the following to your CMakeLists.txt:
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
The issue comes from the "Linux - Generic" of the MySQL connector which have likely been built without the new CXX11 ABI of GCC (introduced in gcc 5.1).
Since your compiler is recent, the default is to use the new ABI, so when you include <mysqlx/xdevapi.h>, you create declarations such as:
mysqlx::string::Impl::from_utf8(
mysqlx::string&,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
...that use the new ABI (see the __cxx11 namespace).
But since the connectors have been built with the old ABI, the libmysqlcppconn8.so contains symbols for functions matching this kind of declaration:
mysqlx::string::Impl::from_utf8(
mysqlx::string&,
std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
You can check this by running readelf -Ws libmysqlcppconn8.so, for the "Linux - Generic" version I get (with a grep from_utf8)1:
1428: 00000000000a0a86 193 FUNC GLOBAL DEFAULT 12 _ZN6mysqlx6string4Impl9from_utf8ERS0_RKSs
9437: 00000000000a0a86 193 FUNC GLOBAL DEFAULT 12 _ZN6mysqlx6string4Impl9from_utf8ERS0_RKSs
But for the Ubuntu 18.10 version I get:
725: 00000000000a23e0 183 FUNC GLOBAL DEFAULT 12 _ZN6mysqlx6string4Impl9from_utf8ERS0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
10141: 00000000000a23e0 183 FUNC GLOBAL DEFAULT 12 _ZN6mysqlx6string4Impl9from_utf8ERS0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
The easiest fix is to tell your compiler to use the old ABI, so that the symbol will match. This can be done by setting the _GLIBCXX_USE_CXX11_ABI macro to 0 when compiling:
g++ -D_GLIBCXX_USE_CXX11_ABI=0 main.cpp
...or by adding the following to CMakeLists.txt:
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
If you use multiple external libraries, you have to be careful that those also use the old ABI, otherwise you will likely face the opposite issue, i.e., a library built with the new ABI cannot be used directly to build a program with the old ABI.
1 The "Linux - Generic" version contains reference to the CXX11 ABI, so I do not really know what is going on here. It looks like some parts of the library has been compile with the new ABI.
You may need to download the specific version for current OS instead generic-linux version.
for example rhel8 x86_64 platform, the mysql-connector-c++-8.0.23-1.el8.x86_64.rpm and mysql-connector-c++-devel-8.0.23-1.el8.x86_64.rpm should be downloaded. (https://dev.mysql.com/downloads/connector/cpp/)
Then unarchive that into same folder. (note if you have windows system, please unarchive it in linux since there's some soft link in it)
Then just using it without old CXX11ABI (need NOT to define _GLIBCXX_USE_CXX11_ABI=0)
So, I cloned SqAtx's GitHub repository SuperMarioWorld onto my Ubuntu 16.04 (64bit) machine. I would like to run his Super Mario clone in order to understand his project and learn by the way he did this game.
First of all, I could not compile it as he explained it in the README.md. However, I have successfully compiled an own Battleship game the same way (which tells me Cmake, make, SFML, and a C compiler are correctly installed). As an error I got this error message after running cmake .. from the build folder:
CMake Error at CMakeLists.txt:24 (add_executable):
add_executable called with incorrect number of arguments
-- Found SFML 2.4.0 in /usr/include
CMake Error at CMakeLists.txt:32 (target_link_libraries):
Cannot specify link libraries for target "SuperMarioWorld" which is not
built by this project.
-- Configuring incomplete, errors occurred!
I then modified his CMakeList.txt so that it successfully creates a makefile. My CMakeList.txt looks as follows:
#Change this if you need to target a specific CMake version
cmake_minimum_required (VERSION 2.6)
# Enable debug symbols by default
# must be done before project() statement
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif()
project (SuperMarioWorld)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -Wall -g")
# I guess you have not released the project yet :p
set (SuperMarioWorld_VERSION_MAJOR 0)
set (SuperMarioWorld_VERSION_MINOR 1)
set (SuperMarioWorld_VERSION_PATCH 0)
include_directories("${PROJECT_BINARY_DIR}")
set(SOURCE_FILES
EventEngine/Listeners/CharacterDiedListener.cpp
EventEngine/Listeners/CharacterPositionUpdateListener.cpp
EventEngine/Listeners/CloseRequestListener.cpp
EventEngine/Listeners/DebugInfoUpdatedListener.cpp
EventEngine/Listeners/ForegroundItemRemovedListener.cpp
EventEngine/Listeners/ForegroundItemUpdatedListener.cpp
EventEngine/Listeners/GotLevelInfoListener.cpp
EventEngine/Listeners/KeyboardListener.cpp
EventEngine/Listeners/LevelStartListener.cpp
EventEngine/Listeners/MarioJumpListener.cpp
EventEngine/Listeners/MarioKickedEnemyListener.cpp
EventEngine/Listeners/NewCharacterReadListener.cpp
EventEngine/Listeners/NewForegroundItemReadListener.cpp
EventEngine/Listeners/NewPipeReadListener.cpp
EventEngine/Listeners/ToggleIgnoreInputListener.cpp
EventEngine/EventEngine.cpp
Game/CollisionHandler.cpp
Game/GameEngine.cpp
Game/LevelImporter.cpp
Graphics/GraphicsEngine.cpp
Graphics/SpriteHandler.cpp
Sound/SoundEngine.cpp
SuperMario/Game.cpp
SuperMario/main.cpp
System/Characters/Enemy.cpp
System/Characters/Goomba.cpp
System/Characters/MovingObject.cpp
System/Characters/Player.cpp
System/Items/Box.cpp
System/Items/Pipe.cpp
System/irrXML/irrXML.cpp
System/Engine.cpp
System/Util.cpp
)
# Define sources and executable
set (EXECUTABLE_NAME "SuperMarioWorld")
add_executable(${EXECUTABLE_NAME} ${SOURCE_FILES})
# Detect and add SFML
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/lib" ${CMAKE_MODULE_PATH})
#Find any version 2.X of SFML
#See the FindSFML.cmake file for additional details and instructions
find_package(SFML 2 REQUIRED system window graphics network audio)
if(SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
endif()
# Install target
install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin)
With this CMakeList.txt I could successfully create a makefile. Running the make I first got two errors which where the same:
/home/lex/Documents/cs/games/SuperMarioWorld/EventEngine/Listeners/NewForegroundItemReadListener.cpp:21:95: error: taking address of temporary [-fpermissive]
m_graphicsEngine->UpdateForegroundItem(&(_event->GetDisplayableObject()->GetInfoForDisplay()));
So I had to fix it in NewPipeReadListener.cpp on line 24 and in NewForegroundItemReadListener.cpp on line 24. I fixed it like this:
InfoForDisplay temp = _event->GetPipe()->GetInfoForDisplay();
m_graphicsEngine->UpdateForegroundItem(&temp);
Now, the makefile gives me an error I cannot fix, since I don't understand a word.. I would like to include the whole error message here, but Stackoverflow doesn't allow me to do so...
But it starts like this.
[ 2%] Linking CXX executable SuperMarioWorld
CMakeFiles/SuperMarioWorld.dir/EventEngine/Listeners/KeyboardListener.cpp.o: In function `KeyboardListener::onEvent(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Event*)':
/home/lex/Documents/cs/games/SuperMarioWorld/EventEngine/Listeners/KeyboardListener.cpp:12: undefined reference to `KeyboardEvent::GetType()'
/home/lex/Documents/cs/games/SuperMarioWorld/EventEngine/Listeners/KeyboardListener.cpp:13: undefined reference to `KeyboardEvent::GetKey()'
/home/lex/Documents/cs/games/SuperMarioWorld/EventEngine/Listeners/KeyboardListener.cpp:14: undefined reference to `KeyboardEvent::GetType()'
/home/lex/Documents/cs/games/SuperMarioWorld/EventEngine/Listeners/KeyboardListener.cpp:15: undefined reference to `KeyboardEvent::GetKey()'
CMakeFiles/SuperMarioWorld.dir/Game/CollisionHandler.cpp.o: In function `CollisionHandler::HandleCollisionsWithMapEdges(MovingObject&)':
/home/lex/Documents/cs/games/SuperMarioWorld/Game/CollisionHandler.cpp:25: undefined reference to `DisplayableObject::GetCoordinates() const'
CMakeFiles/SuperMarioWorld.dir/Game/CollisionHandler.cpp.o: In function `CollisionHandler::DetectCollisionWithObj(MovingObject&, DisplayableObject&)':
I would appreciate if someone could help me understand this error and possibly make the project run on my system.
EDIT:
After fixing the the first error which was including EventEngine/KeyboardEvent.cpp it links up to a 100% and spits out the following error message:
[100%] Linking CXX executable SuperMarioWorld
CMakeFiles/SuperMarioWorld.dir/Game/CollisionHandler.cpp.o: In function `CollisionHandler::HandleCollisionsWithMapEdges(MovingObject&)':
/home/lex/Documents/cs/games/SuperMarioWorld/Game/CollisionHandler.cpp:25: undefined reference to `DisplayableObject::GetCoordinates() const'
CMakeFiles/SuperMarioWorld.dir/Game/CollisionHandler.cpp.o: In function `CollisionHandler::DetectCollisionWithObj(MovingObject&, DisplayableObject&)':
/home/lex/Documents/cs/games/SuperMarioWorld/Game/CollisionHandler.cpp:40: undefined reference to `DisplayableObject::GetCoordinates() const'
/home/lex/Documents/cs/games/SuperMarioWorld/Game/CollisionHandler.cpp:40: undefined reference to `DisplayableObject::GetCoordinates() const'
CMakeFiles/SuperMarioWorld.dir/Game/CollisionHandler.cpp.o: In function `CollisionHandler::ReactToCollisionsWithObj(MovingObject&, DisplayableObject&, CollisionDirection)':
/home/lex/Documents/cs/games/SuperMarioWorld/Game/CollisionHandler.cpp:45: undefined reference to `DisplayableObject::GetCoordinates() const'
CMakeFiles/SuperMarioWorld.dir/Game/CollisionHandler.cpp.o: In function `CollisionHandler::HandleCollisionWithRect(unsigned int, sf::Rect<float>)':
/home/lex/Documents/cs/games/SuperMarioWorld/Game/CollisionHandler.cpp:73: undefined reference to `DisplayableObject::GetCoordinates() const'
CMakeFiles/SuperMarioWorld.dir/Game/CollisionHandler.cpp.o:/home/lex/Documents/cs/games/SuperMarioWorld/Game/CollisionHandler.cpp:138: more undefined references to `DisplayableObject::GetCoordinates() const' follow
CMakeFiles/SuperMarioWorld.dir/Game/GameEngine.cpp.o: In function `GameEngine::UpdateForegroundItem(unsigned int, sf::Rect<float>)':
/home/lex/Documents/cs/games/SuperMarioWorld/Game/GameEngine.cpp:114: undefined reference to `DisplayableObject::SetCoordinates(sf::Rect<float>)'
CMakeFiles/SuperMarioWorld.dir/Game/LevelImporter.cpp.o: In function `LevelImporter::StoreFloor()':
/home/lex/Documents/cs/games/SuperMarioWorld/Game/LevelImporter.cpp:180: undefined reference to `DisplayableObject::DisplayableObject(EventEngine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, sf::Vector2<float>, State)'
CMakeFiles/SuperMarioWorld.dir/System/Characters/MovingObject.cpp.o: In function `MovingObject::MovingObject(EventEngine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, sf::Vector2<float>, State)':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Characters/MovingObject.cpp:5: undefined reference to `DisplayableObject::DisplayableObject(EventEngine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, sf::Vector2<float>, State)'
/home/lex/Documents/cs/games/SuperMarioWorld/System/Characters/MovingObject.cpp:5: undefined reference to `DisplayableObject::~DisplayableObject()'
CMakeFiles/SuperMarioWorld.dir/System/Characters/MovingObject.cpp.o: In function `MovingObject::MovingObject(EventEngine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, float, float, State)':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Characters/MovingObject.cpp:10: undefined reference to `DisplayableObject::DisplayableObject(EventEngine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, float, float, State)'
/home/lex/Documents/cs/games/SuperMarioWorld/System/Characters/MovingObject.cpp:10: undefined reference to `DisplayableObject::~DisplayableObject()'
CMakeFiles/SuperMarioWorld.dir/System/Characters/MovingObject.cpp.o: In function `MovingObject::~MovingObject()':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Characters/MovingObject.cpp:25: undefined reference to `DisplayableObject::~DisplayableObject()'
CMakeFiles/SuperMarioWorld.dir/System/Characters/MovingObject.cpp.o: In function `MovingObject::GetInfoForDisplay()':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Characters/MovingObject.cpp:32: undefined reference to `DisplayableObject::GetInfoForDisplay()'
CMakeFiles/SuperMarioWorld.dir/System/Characters/MovingObject.cpp.o:(.rodata._ZTI12MovingObject[_ZTI12MovingObject]+0x10): undefined reference to `typeinfo for DisplayableObject'
CMakeFiles/SuperMarioWorld.dir/System/Items/Box.cpp.o: In function `Box::Box(EventEngine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, sf::Vector2<float>, State)':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Items/Box.cpp:3: undefined reference to `DisplayableObject::DisplayableObject(EventEngine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, sf::Vector2<float>, State)'
CMakeFiles/SuperMarioWorld.dir/System/Items/Box.cpp.o: In function `Box::Box(EventEngine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, float, float, State)':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Items/Box.cpp:8: undefined reference to `DisplayableObject::DisplayableObject(EventEngine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, float, float, State)'
CMakeFiles/SuperMarioWorld.dir/System/Items/Box.cpp.o:(.rodata._ZTV3Box[_ZTV3Box]+0x20): undefined reference to `DisplayableObject::GetInfoForDisplay()'
CMakeFiles/SuperMarioWorld.dir/System/Items/Box.cpp.o: In function `Box::~Box()':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Items/Box.hpp:9: undefined reference to `DisplayableObject::~DisplayableObject()'
CMakeFiles/SuperMarioWorld.dir/System/Items/Box.cpp.o:(.rodata._ZTI3Box[_ZTI3Box]+0x10): undefined reference to `typeinfo for DisplayableObject'
CMakeFiles/SuperMarioWorld.dir/System/Items/Pipe.cpp.o: In function `Pipe::Pipe(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, sf::Vector2<float>, int, PipeType, EventEngine*)':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Items/Pipe.cpp:5: undefined reference to `DisplayableObject::DisplayableObject(EventEngine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, sf::Vector2<float>, State)'
/home/lex/Documents/cs/games/SuperMarioWorld/System/Items/Pipe.cpp:5: undefined reference to `DisplayableObject::~DisplayableObject()'
CMakeFiles/SuperMarioWorld.dir/System/Items/Pipe.cpp.o: In function `Pipe::~Pipe()':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Items/Pipe.cpp:14: undefined reference to `DisplayableObject::~DisplayableObject()'
CMakeFiles/SuperMarioWorld.dir/System/Items/Pipe.cpp.o: In function `Pipe::SpawnEnemyIfTimeElapsed()':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Items/Pipe.cpp:50: undefined reference to `DisplayableObject::DisplayableObject(EventEngine*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, float, float, State)'
CMakeFiles/SuperMarioWorld.dir/System/Items/Pipe.cpp.o: In function `Pipe::MoveEnemyBeingSpawned(float)':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Items/Pipe.cpp:58: undefined reference to `DisplayableObject::Slide(float, float)'
CMakeFiles/SuperMarioWorld.dir/System/Items/Pipe.cpp.o: In function `Pipe::IsEnemyReadyToLeavePipe()':
/home/lex/Documents/cs/games/SuperMarioWorld/System/Items/Pipe.cpp:92: undefined reference to `DisplayableObject::GetCoordinates() const'
CMakeFiles/SuperMarioWorld.dir/System/Items/Pipe.cpp.o:(.rodata._ZTV4Pipe[_ZTV4Pipe]+0x20): undefined reference to `DisplayableObject::GetInfoForDisplay()'
CMakeFiles/SuperMarioWorld.dir/System/Items/Pipe.cpp.o:(.rodata._ZTV4Pipe[_ZTV4Pipe]+0x28): undefined reference to `DisplayableObject::UpdateAfterCollision(CollisionDirection, ObjectClass)'
CMakeFiles/SuperMarioWorld.dir/System/Items/Pipe.cpp.o:(.rodata._ZTI4Pipe[_ZTI4Pipe]+0x10): undefined reference to `typeinfo for DisplayableObject'
collect2: error: ld returned 1 exit status
CMakeFiles/SuperMarioWorld.dir/build.make:957: recipe for target 'SuperMarioWorld' failed
make[2]: *** [SuperMarioWorld] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/SuperMarioWorld.dir/all' failed
make[1]: *** [CMakeFiles/SuperMarioWorld.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
EDIT2:
Now, I feel stupid, there was another file I forgot to include, it was System/DisplayableObject.cpp.
Thanks, everyone for the help!!!
You did not include all the source files in the build.
For instance, in your error message the linker is complaining that it is missing the definition for the KeyboardEvent::GetType() function.
Searching the repo on github for KeyboardEvent will quickly tell you that this function is defined in EventEngine/KeyboardEvent.cpp, which is not part of your CMake's SOURCE_FILES.
You might be missing other source files as well. Try fixing the linker errors one by one until it compiles.