I am not able to build a simple Hello World program in GCC-6 but it works fine with Clang in Clion.
Now I try to build and run the first example of Boost Date Time here
My CMake looks like
cmake_minimum_required(VERSION 3.16)
project(Boost_Run_2)
set(CMAKE_CXX_STANDARD 11)
find_package(Boost REQUIRED COMPONENTS date_time)
add_executable(Boost_Run_2 main.cpp)
target_link_libraries(Boost_Run_2 PRIVATE Boost::date_time)
But it throws linker error as
====================[ Build | Boost_Run_2 | Debug ]=============================
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/alihasan/Documents/GSOC/Boost_Run_2/cmake-build-debug --target Boost_Run_2 -- -j 4
Scanning dependencies of target Boost_Run_2
[ 50%] Building CXX object CMakeFiles/Boost_Run_2.dir/main.cpp.o
[100%] Linking CXX executable Boost_Run_2
Undefined symbols for architecture x86_64:
"boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()", referenced from:
unsigned short boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in main.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[3]: *** [Boost_Run_2] Error 1
make[2]: *** [CMakeFiles/Boost_Run_2.dir/all] Error 2
make[1]: *** [CMakeFiles/Boost_Run_2.dir/rule] Error 2
make: *** [Boost_Run_2] Error 2
When I run the same program with Clang I am able to run it. No linker errors. So I am assuming my Boost Libraries are set up properly.
I want to be able to run the same program using GCC-6/G++-6.
I have a macOS Mojave 10.14.3 and I used brew install boost
to install Boost libraries.