boost linker errors
Hi
I am trying to link to a boost library, program_options, using Visual Studio 2015 and I am getting 'lnk2019 unresolved external symbol’ errors.
I have built the boost libraries using b2 and built the complete libraries for msvc. The libraries are 32 bit. I have configured visual studio to point at the correct location for both the headers and the libraries, I’ve confirmed this. I am statically linking against libboost_program_options-vc140-mt-sgd-1_60.lib, though I have tried all the other variants of this library, e.g. removed the mt, the gd and the s parts of the name, without effect. I have tried all the different calling convention options in properties, I am building with the /MTd option set, though I have tried others. i have searched the internet thoroughly and cannot find a replication of my problem. Using BOOST_LIB_DIAGNOSTIC confirms that the library is being linked, I see the message in the output window. The errors I am getting are:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "void __cdecl simulate(class nemo::Simulation *,unsigned int,unsigned int,class std::basic_ostream
FWIW, the functions simulate, benchmark, configuration, processOptions,
commonOptions are all functions created by you. I would guess
program_options is not the problem, it most probably get's linked, as you
seem to say yourself.
Are the above functions member functions of a templated class (or are free
and templated themselves). You possibly implemented those functions in a
source file, i.e. a non-header file? If so, move the implementations to the
relevant header file.
degski
On 20 March 2016 at 20:03, Mark
Hi
I am trying to link to a boost library, program_options, using Visual Studio 2015 and I am getting 'lnk2019 unresolved external symbol’ errors.
I have built the boost libraries using b2 and built the complete libraries for msvc. The libraries are 32 bit. I have configured visual studio to point at the correct location for both the headers and the libraries, I’ve confirmed this. I am statically linking against libboost_program_options-vc140-mt-sgd-1_60.lib, though I have tried all the other variants of this library, e.g. removed the mt, the gd and the s parts of the name, without effect. I have tried all the different calling convention options in properties, I am building with the /MTd option set, though I have tried others. i have searched the internet thoroughly and cannot find a replication of my problem. Using BOOST_LIB_DIAGNOSTIC confirms that the library is being linked, I see the message in the output window. The errors I am getting are:
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "void __cdecl simulate(class nemo::Simulation *,unsigned int,unsigned int,class std::basic_ostream
&)" (?simulate@ @YAXPAVSimulation@nemo@@IIAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) referenced in function _main NeMo_Test C:\Users\Development\Documents\Visual Studio 2015\Projects\NeMo_Test\NeMo_Test\main.obj 1 Error LNK2019 unresolved external symbol "long __cdecl benchmark(class nemo::Simulation *,unsigned int,unsigned int,class boost::program_options::variables_map &,unsigned int)" (?benchmark@ @YAJPAVSimulation@nemo@@IIAAVvariables_map@program_options@boost@@I@Z) referenced in function _main NeMo_Test C:\Users\Development\Documents\Visual Studio 2015\Projects\NeMo_Test\NeMo_Test\main.obj 1 Error LNK2019 unresolved external symbol "class nemo::Configuration __cdecl configuration(class boost::program_options::variables_map &)" (?configuration@@YA?AVConfiguration@nemo@@AAVvariables_map@program_options @boost@@@Z) referenced in function _main NeMo_Test C:\Users\Development\Documents\Visual Studio 2015\Projects\NeMo_Test\NeMo_Test\main.obj 1 Error LNK2019 unresolved external symbol "class boost::program_options::variables_map __cdecl processOptions(int,char * * const,class boost::program_options::options_description const &)" (?processOptions@@YA?AVvariables_map@program_options@boost@ @HQAPADABVoptions_description@23@@Z) referenced in function _main NeMo_Test C:\Users\Development\Documents\Visual Studio 2015\Projects\NeMo_Test\NeMo_Test\main.obj 1 Error LNK2019 unresolved external symbol "class boost::program_options::options_description __cdecl commonOptions(void)" (?commonOptions@@YA?AVoptions_description@program_options@boost@@XZ) referenced in function _main NeMo_Test C:\Users\Development\Documents\Visual Studio 2015\Projects\NeMo_Test\NeMo_Test\main.obj 1 Error LNK1120 5 unresolved externals NeMo_Test C:\Users\Development\Documents\Visual Studio 2015\Projects\NeMo_Test\Debug\NeMo_Test.exe 1 I would be very grateful if anyone could provide a clue as to what I am missing or have done wrong.
Many thanks
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- (\___/) (+'.'+) (")_(") This is Bunny. Copy and paste Bunny into your signature to help him gain world domination!
Hi degski
Thanks a lot for that, I didn’t even see that. I’m actually linking in to another library as well, and this must be what’s causing the problem. My apologies for wasting your time, I should have checked for carefully.
Best regards
Mark
From: degski
Sent: Monday, March 21, 2016 6:16 AM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] boost linker errors
FWIW, the functions simulate, benchmark, configuration, processOptions, commonOptions are all functions created by you. I would guess program_options is not the problem, it most probably get's linked, as you seem to say yourself.
Are the above functions member functions of a templated class (or are free and templated themselves). You possibly implemented those functions in a source file, i.e. a non-header file? If so, move the implementations to the relevant header file.
degski
On 20 March 2016 at 20:03, Mark
participants (2)
-
degski
-
Mark