Using Boost archives, alot of undefined functions appear, despite being present in the file

  archive, boost, c++

I am using Boost’s Archive library, and i have many "undefined reference" errors to functions in the archive namespace.

C:/Users/Ethan/BoostFolder/boost_1_75_0/boost_1_75_0/boost/archive/detail/oserializer.hpp:92: 
undefined reference to `boost::archive::detail::basic_oarchive::end_preamble()'
CMakeFilesBoostTest.dir/objects.a(CPlayGround.cpp.obj): In function `void 
boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::class_id_type>(boost::archive::text_oarchive&, boost::archive::class_id_type const&)':

This error appears only when i use an instance in the archive.

         int main() {
text_oarchive a{std::cout}; 
         }

CMakeLists.txt:

       set(CMAKE_CXX_STANDARD 20)

 set(Boost_INCLUDE_DIR C:/Users/Ethan/BoostFolder/boost_1_75_0/boost_1_75_0)
 set(Boost_LIBRARY_DIR C:/Users/Ethan/BoostFolder/boost_1_75_0/boost_1_75_0/libs)

 add_executable(Lantern
      BattleManager.h
      CharacterComponents.h
      CMain.c++
      CTests.cpp
      CTree.h
      GameCharacters.h
      GameCommands.h
      GameStructure_main.h
      GameUtilities.h CPlayGround.h)




      add_executable(BoostTest CPlayGround.cpp)
      include_directories(${Boost_INCLUDE_DIR})

Source: Windows Questions C++

LEAVE A COMMENT