Problem adding boost:serialization libraries to Visual Studio Code

Viewed 6

I am trying to use boost::serialization libraries in Visual Studio, but I am facing some problem when I add this libs to my project. I have build the boost::serialization libraries giving as output the different variants. I am using g++ compiler support for Windows (sys64\mingw64\bin\g++.exe). Gcc version is 11.2.0. Here is the project-config.jam file:

# Boost.Build Configuration 
# Automatically generated by bootstrap.bat 
 
import option ; 
 
using gcc : 11.2.0 : C:\\msys64\\mingw64\\bin\\g++.exe ; 
 
option.set keep-going : false ;

The I have build the libraries through:

b2 toolset=gcc --with-serialization --build-type=complete stage

This is my task.json file:

{
"version": "2.0.0",
"tasks": [
    {
        "type": "cppbuild",
        "label": "C/C++: g++.exe build active file",
        "command": "gcc",
        "args": [
            "-fdiagnostics-color=always",
            "-g",
            "${file}",
            "-o",
            "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "-I",
            "C:\\Users\\user_name\\Training\\Udemy Modern C++\\Utilities\\boost_1_78_0",
            "-L",
            "C:\\Users\\user_name\\Training\\Udemy Modern C++\\Utilities\\boost_1_78_0\\bin.v2\\libs",
            "-llibboost_serialization-mgw11-mt-s-x64-1_78.a"
        ],
        "options": {
            "cwd": "${fileDirname}"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": "build",
        "detail": "compiler: C:\\msys64\\mingw64\\bin\\g++.exe"

but when I try to compile my cpp file I obtain next error:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\FERNAN~1.GUT\AppData\Local\Temp\3\cc3WuxhU.o: in function `boost::archive::text_oarchive::text_oarchive(std::ostream&, unsigned int)':
C:/Users/fernando.gutierrez/Training/Udemy Modern C++/Utilities/boost_1_78_0/boost/archive/text_oarchive.hpp:104: undefined reference to `boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::text_oarchive_impl(std::ostream&, unsigned int)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/fernando.gutierrez/Training/Udemy Modern C++/Utilities/boost_1_78_0/boost/archive/text_oarchive.hpp:107: undefined reference to `boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::init()'

The code is a simple code example of use of serialization.

I have tried adding all the different variants of the serialization library without success. Has anyone any idea on what is going on? I am new on using boost, so maybe it is a not completely well formulated question.

Thank you in advance.

0 Answers
Related