Undefined symbols for architecture x86_64:
"__ZN5boost15program_options11to_internalERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", referenced from:
__ZN5boost15program_options11to_internalINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESt6vectorIS7_SaIS7_EERKS8_IT_SaISB_EE in ccmlvHtI.o
"__ZN5boost15program_options16validation_error12get_templateB5cxx11ENS1_6kind_tE", referenced from:
__ZN5boost15program_options16validation_errorC1ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i in ccmlvHtI.o
"__ZN5boost15program_options19options_descriptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEjj", referenced from:
_main in ccmlvHtI.o
"__ZN5boost15program_options20invalid_option_valueC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", referenced from:
__ZN5boost15program_options8validateIicEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l in ccmlvHtI.o
"__ZN5boost15program_options22error_with_option_nameC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_S9_i", referenced from:
__ZN5boost15program_options16validation_errorC1ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i in ccmlvHtI.o
"__ZN5boost15program_options3argB5cxx11E", referenced from:
__ZNK5boost15program_options11typed_valueIicE4nameB5cxx11Ev in ccmlvHtI.o
"__ZN5boost15program_options6detail7cmdline21set_additional_parserENS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_ERKSA_EE", referenced from:
__ZN5boost15program_options25basic_command_line_parserIcE12extra_parserENS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_ERKSA_EE in ccmlvHtI.o
"__ZN5boost15program_options6detail7cmdlineC2ERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS9_EE", referenced from:
__ZN5boost15program_options25basic_command_line_parserIcEC1EiPKPKc in ccmlvHtI.o
"__ZN5boost15program_optionslsERSoRKNS0_19options_descriptionE", referenced from:
_main in ccmlvHtI.o
"__ZNK5boost15program_options22abstract_variables_mapixERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", referenced from:
__ZNK5boost15program_options13variables_mapixERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in ccmlvHtI.o
"__ZNK5boost15program_options22error_with_option_name23substitute_placeholdersERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", referenced from:
__ZTVN5boost15program_options20invalid_option_valueE in ccmlvHtI.o
__ZTVN5boost15program_options16validation_errorE in ccmlvHtI.o
__ZTVN5boost10wrapexceptINS_15program_options16validation_errorEEE in ccmlvHtI.o
__ZTVN5boost10wrapexceptINS_15program_options20invalid_option_valueEEE in ccmlvHtI.o
"__ZNK5boost15program_options29value_semantic_codecvt_helperIcE5parseERNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EEb", referenced from:
__ZTVN5boost15program_options11typed_valueIicEE in ccmlvHtI.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
The terminal process "zsh '-c', 'g++-11 -g -I/usr/local/Cellar/boost/1.76.0/include/ -I/usr/local/include/ -L/usr/local/Cellar/boost/1.76.0/lib/ -lboost_program_options -std=gnu++20 Chapter01/01_A_program_options_base/main.cpp -o Chapter01/01_A_program_options_base/main'" terminated with exit code: 1.
The compile options are (Visual Studio Code):
"label": "Build with g++ 11",
"type": "shell",
"command": "g++-11",
"args": [
"-g",
"-I/usr/local/Cellar/boost/1.76.0/include/",
"-I/usr/local/include/",
"-L/usr/local/Cellar/boost/1.76.0/lib/",
"-lboost_program_options",
// "-lboost_system",
// "-lboost_filesystem",
// "-lboost_chrono",
"-std=gnu++20",
"Chapter01/01_A_program_options_base/main.cpp",
// "-L/usr/local/Cellar/gcc/11.1.0_1/lib/gcc/11/",
"-o",
"Chapter01/01_A_program_options_base/main"
]
Thanks
Stefano Gragnani