This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 6 years ago.
I'm a beginner C++ programmer. I'm trying Google Test in Visual Studio 2012 and have problem starting a demo source code I got from internet.
int CompareChar(char* ch1, char* ch2)
{
if (ch1 == NULL || ch2 == NULL)
return 88;
return strcmp(ch1, ch2);
}
TEST(CompareCharTest, InputChar) {
// Expect equal
EXPECT_EQ(0, CompareChar("hello", "hello"));
// Expect not equal
EXPECT_NE(0, CompareChar("hello", "world"));
}
TEST(SampleClassTest, InputNumber) {
SampleClass sample(10);
EXPECT_EQ(1, sample.CompareValue(10)); // Expect equal
}
int _tmain(int argc, _TCHAR* argv[])
{
::testing::InitGoogleTest(&argc, argv);
int i = RUN_ALL_TESTS();
getchar();
return i;
}
So, when I try to build the code, it generates dozens of linking errors which I couldn't sort out. I tried to include .lib files in the property of the project but couldn't solve it.
The error:
>1>------ Build started: Project: GTestSample, Configuration: Release Win32 ------
>1> stdafx.cpp
1> GTestSample.cpp
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall testing::Message::GetString(void)const " (?GetString#Message#testing##QBE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::Message::Message(void)" (??0Message#testing##QAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: static class testing::UnitTest * __cdecl testing::UnitTest::GetInstance(void)" (?GetInstance#UnitTest#testing##SAPAV12#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: int __thiscall testing::UnitTest::Run(void)" (?Run#UnitTest#testing##QAEHXZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "protected: __thiscall testing::Test::Test(void)" (??0Test#testing##IAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall testing::Test::~Test(void)" (??1Test#testing##UAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::TestInfo * __cdecl testing::internal::MakeAndRegisterTestInfo(char const *,char const *,char const *,char const *,void const *,void (__cdecl*)(void),void (__cdecl*)(void),class testing::internal::TestFactoryBase *)" (?MakeAndRegisterTestInfo#internal#testing##YAPAVTestInfo#2#PBD000PBXP6AXXZ2PAVTestFactoryBase#12##Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "void const * __cdecl testing::internal::GetTestTypeId(void)" (?GetTestTypeId#internal#testing##YAPBXXZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: void __thiscall testing::internal::AssertHelper::operator=(class testing::Message const &)const " (??4AssertHelper#internal#testing##QBEXABVMessage#2##Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::internal::AssertHelper::AssertHelper(enum testing::TestPartResult::Type,char const *,int,char const *)" (??0AssertHelper#internal#testing##QAE#W4Type#TestPartResult#2#PBDH1#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::internal::AssertHelper::~AssertHelper(void)" (??1AssertHelper#internal#testing##QAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "void __cdecl testing::InitGoogleTest(int *,wchar_t * *)" (?InitGoogleTest#testing##YAXPAHPAPA_W#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "bool __cdecl testing::internal::IsTrue(bool)" (?IsTrue#internal#testing##YA_N_N#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::AssertionResult __cdecl testing::AssertionSuccess(void)" (?AssertionSuccess#testing##YA?AVAssertionResult#1#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::AssertionResult::AssertionResult(class testing::AssertionResult const &)" (??0AssertionResult#testing##QAE#ABV01##Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::AssertionResult __cdecl testing::AssertionFailure(void)" (?AssertionFailure#testing##YA?AVAssertionResult#1#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::AssertionResult __cdecl testing::internal::EqFailure(char const *,char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)" (?EqFailure#internal#testing##YA?AVAssertionResult#2#PBD0ABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##1_N#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall testing::Test::SetUp(void)" (?SetUp#Test#testing##MAEXXZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall testing::Test::TearDown(void)" (?TearDown#Test#testing##MAEXXZ)
1>D:\VisualStudioProj\GTestSample\Release\GTestSample.exe : fatal error LNK1120: 19 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I had the same issue. Make sure that in your test project's properties, you go into Project->Linker->General settings and add the msvc/Release directory to Additional Directories. Furthermore, under Linker->Input, add gtest.lib into Additional Dependencies. Then you should be good to go!
I know this post is old, but it could still help anyone out. A quick Google search for "LNK2019 unresolved external symbol "bool __cdecl testing::internal::IsTrue ..." as stated above gives this stackoverflow and several sites with the same answers.
For those that tried Oleg Vaskevich solution or similar and failed, try this. If you are using Visual Studio, C/C++ -> General -> Additional Include Directories and make sure that the gtest is included. Secondly, (which will likely be your answer), copy the gtest-all.cc in the gtest/scr/ folder and paste in your project directory (wherever your .cpp/.h files are saved), then go back to Visual Studio and include it in your project. You will have to unhide files/folders to view it. 'Include to project'.
I know that copying and pasting this isn't ideal for every project, but the point is to at least get it working and making sure this is the true problem and not something else.
Because I never complied my version, I never had any lib files to begin with.
Related
I'm having problem while trying to use boost log. I'm getting following error message:
1>------ Build started: Project: vms, Configuration: Release x64 ------
1> main.cpp
1> Linking to lib file: libboost_system-vc140-mt-1_60.lib
1> Linking to lib file: libboost_date_time-vc140-mt-1_60.lib
1> Linking to lib file: libboost_regex-vc140-mt-1_60.lib
1> Linking to lib file: libboost_log-vc140-mt-1_60.lib
1> Linking to lib file: libboost_filesystem-vc140-mt-1_60.lib
1> Linking to lib file: libboost_date_time-vc140-mt-1_60.lib
1> Linking to lib file: libboost_thread-vc140-mt-1_60.lib
1> Linking to lib file: libboost_atomic-vc140-mt-1_60.lib
1> Linking to lib file: libboost_chrono-vc140-mt-1_60.lib
1> Linking to lib file: libboost_log_setup-vc140-mt-1_60.lib
1>main.obj : error LNK2001: unresolved external symbol "public: static void __cdecl boost::log::v2s_mt_nt5::aux::stream_provider<char>::release_compound(struct boost::log::v2s_mt_nt5::aux::stream_provider<char>::stream_compound *)" (?release_compound#?$stream_provider#D#aux#v2s_mt_nt5#log#boost##SAXPEAUstream_compound#12345##Z)
1>main.obj : error LNK2001: unresolved external symbol "public: static struct boost::log::v2s_mt_nt5::aux::stream_provider<char>::stream_compound * __cdecl boost::log::v2s_mt_nt5::aux::stream_provider<char>::allocate_compound(class boost::log::v2s_mt_nt5::record &)" (?allocate_compound#?$stream_provider#D#aux#v2s_mt_nt5#log#boost##SAPEAUstream_compound#12345#AEAVrecord#345##Z)
1>main.obj : error LNK2001: unresolved external symbol "void __cdecl boost::log::v2s_mt_nt5::aux::attach_attribute_name_info(class boost::exception &,class boost::log::v2s_mt_nt5::attribute_name const &)" (?attach_attribute_name_info#aux#v2s_mt_nt5#log#boost##YAXAEAVexception#4#AEBVattribute_name#234##Z)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::aux::id<struct boost::log::v2s_mt_nt5::aux::process> __cdecl boost::log::v2s_mt_nt5::aux::this_process::get_id(void)" (?get_id#this_process#aux#v2s_mt_nt5#log#boost##YA?AV?$id#Uprocess#aux#v2s_mt_nt5#log#boost###2345#XZ)
1>main.obj : error LNK2001: unresolved external symbol "unsigned int __cdecl boost::log::v2s_mt_nt5::aux::unhandled_exception_count(void)" (?unhandled_exception_count#aux#v2s_mt_nt5#log#boost##YAIXZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::process_id(void)" (?process_id#default_attribute_names#aux#v2s_mt_nt5#log#boost##YA?AVattribute_name#345#XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::message(void)" (?message#default_attribute_names#aux#v2s_mt_nt5#log#boost##YA?AVattribute_name#345#XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::thread_id(void)" (?thread_id#default_attribute_names#aux#v2s_mt_nt5#log#boost##YA?AVattribute_name#345#XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::timestamp(void)" (?timestamp#default_attribute_names#aux#v2s_mt_nt5#log#boost##YA?AVattribute_name#345#XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::attribute_name __cdecl boost::log::v2s_mt_nt5::aux::default_attribute_names::line_id(void)" (?line_id#default_attribute_names#aux#v2s_mt_nt5#log#boost##YA?AVattribute_name#345#XZ)
1>main.obj : error LNK2001: unresolved external symbol "void __cdecl boost::log::v2s_mt_nt5::aux::code_convert_impl(wchar_t const *,unsigned __int64,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::locale const &)" (?code_convert_impl#aux#v2s_mt_nt5#log#boost##YAXPEB_W_KAEAV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##AEBVlocale#6##Z)
1>main.obj : error LNK2001: unresolved external symbol "private: void __cdecl boost::log::v2s_mt_nt5::aux::once_block_sentry::rollback(void)" (?rollback#once_block_sentry#aux#v2s_mt_nt5#log#boost##AEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "private: bool __cdecl boost::log::v2s_mt_nt5::aux::once_block_sentry::enter_once_block(void)const " (?enter_once_block#once_block_sentry#aux#v2s_mt_nt5#log#boost##AEBA_NXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::aux::once_block_sentry::commit(void)" (?commit#once_block_sentry#aux#v2s_mt_nt5#log#boost##QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::unlock(void)" (?unlock#light_rw_mutex#aux#v2s_mt_nt5#log#boost##QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::lock(void)" (?lock#light_rw_mutex#aux#v2s_mt_nt5#log#boost##QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::unlock_shared(void)" (?unlock_shared#light_rw_mutex#aux#v2s_mt_nt5#log#boost##QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::lock_shared(void)" (?lock_shared#light_rw_mutex#aux#v2s_mt_nt5#log#boost##QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::~light_rw_mutex(void)" (??1light_rw_mutex#aux#v2s_mt_nt5#log#boost##QEAA#XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __cdecl boost::log::v2s_mt_nt5::aux::light_rw_mutex::light_rw_mutex(void)" (??0light_rw_mutex#aux#v2s_mt_nt5#log#boost##QEAA#XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::aux::id<struct boost::log::v2s_mt_nt5::aux::thread> const & __cdecl boost::log::v2s_mt_nt5::aux::this_thread::get_id(void)" (?get_id#this_thread#aux#v2s_mt_nt5#log#boost##YAAEBV?$id#Uthread#aux#v2s_mt_nt5#log#boost###2345#XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: class boost::log::v2s_mt_nt5::attribute_value_set::const_iterator __cdecl boost::log::v2s_mt_nt5::attribute_value_set::find(class boost::log::v2s_mt_nt5::attribute_name)const " (?find#attribute_value_set#v2s_mt_nt5#log#boost##QEBA?AVconst_iterator#1234#Vattribute_name#234##Z)
1>main.obj : error LNK2001: unresolved external symbol "public: class boost::log::v2s_mt_nt5::attribute_value_set::const_iterator __cdecl boost::log::v2s_mt_nt5::attribute_value_set::end(void)const " (?end#attribute_value_set#v2s_mt_nt5#log#boost##QEBA?AVconst_iterator#1234#XZ)
1>main.obj : error LNK2001: unresolved external symbol "private: void __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::construct(class boost::filesystem::path const &,int,unsigned __int64,class boost::log::v2s_mt_nt5::aux::light_function<bool __cdecl(void)> const &,bool)" (?construct#text_file_backend#sinks#v2s_mt_nt5#log#boost##AEAAXAEBVpath#filesystem#5#H_KAEBV?$light_function#$$A6A_NXZ#aux#345#_N#Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::flush(void)" (?flush#text_file_backend#sinks#v2s_mt_nt5#log#boost##QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::consume(class boost::log::v2s_mt_nt5::record_view const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?consume#text_file_backend#sinks#v2s_mt_nt5#log#boost##QEAAXAEBVrecord_view#345#AEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
1>main.obj : error LNK2001: unresolved external symbol "public: unsigned __int64 __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::scan_for_files(enum boost::log::v2s_mt_nt5::sinks::file::scan_method,bool)" (?scan_for_files#text_file_backend#sinks#v2s_mt_nt5#log#boost##QEAA_KW4scan_method#file#2345#_N#Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::set_file_collector(class boost::shared_ptr<struct boost::log::v2s_mt_nt5::sinks::file::collector> const &)" (?set_file_collector#text_file_backend#sinks#v2s_mt_nt5#log#boost##QEAAXAEBV?$shared_ptr#Ucollector#file#sinks#v2s_mt_nt5#log#boost###5##Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __cdecl boost::log::v2s_mt_nt5::sinks::text_file_backend::~text_file_backend(void)" (??1text_file_backend#sinks#v2s_mt_nt5#log#boost##QEAA#XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __cdecl boost::log::v2s_mt_nt5::attribute_set::~attribute_set(void)" (??1attribute_set#v2s_mt_nt5#log#boost##QEAA#XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __cdecl boost::log::v2s_mt_nt5::attribute_set::attribute_set(void)" (??0attribute_set#v2s_mt_nt5#log#boost##QEAA#XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: static void __cdecl boost::log::v2s_mt_nt5::record_view::public_data::destroy(struct boost::log::v2s_mt_nt5::record_view::public_data const *)" (?destroy#public_data#record_view#v2s_mt_nt5#log#boost##SAXPEBU12345##Z)
1>main.obj : error LNK2001: unresolved external symbol "public: static void __cdecl boost::log::v2s_mt_nt5::attribute::impl::operator delete(void *,unsigned __int64)" (??3impl#attribute#v2s_mt_nt5#log#boost##SAXPEAX_K#Z)
1>main.obj : error LNK2001: unresolved external symbol "public: static void * __cdecl boost::log::v2s_mt_nt5::attribute::impl::operator new(unsigned __int64)" (??2impl#attribute#v2s_mt_nt5#log#boost##SAPEAX_K#Z)
1>main.obj : error LNK2001: unresolved external symbol "private: void __cdecl boost::log::v2s_mt_nt5::core::push_record_move(class boost::log::v2s_mt_nt5::record &)" (?push_record_move#core#v2s_mt_nt5#log#boost##AEAAXAEAVrecord#234##Z)
1>main.obj : error LNK2001: unresolved external symbol "public: class boost::log::v2s_mt_nt5::record __cdecl boost::log::v2s_mt_nt5::core::open_record(class boost::log::v2s_mt_nt5::attribute_set const &)" (?open_record#core#v2s_mt_nt5#log#boost##QEAA?AVrecord#234#AEBVattribute_set#234##Z)
1>main.obj : error LNK2001: unresolved external symbol "public: struct std::pair<class boost::log::v2s_mt_nt5::attribute_set::iter<0>,bool> __cdecl boost::log::v2s_mt_nt5::core::add_global_attribute(class boost::log::v2s_mt_nt5::attribute_name const &,class boost::log::v2s_mt_nt5::attribute const &)" (?add_global_attribute#core#v2s_mt_nt5#log#boost##QEAA?AU?$pair#V?$iter#$0A##attribute_set#v2s_mt_nt5#log#boost##_N#std##AEBVattribute_name#234#AEBVattribute#234##Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __cdecl boost::log::v2s_mt_nt5::core::add_sink(class boost::shared_ptr<class boost::log::v2s_mt_nt5::sinks::sink> const &)" (?add_sink#core#v2s_mt_nt5#log#boost##QEAAXAEBV?$shared_ptr#Vsink#sinks#v2s_mt_nt5#log#boost###4##Z)
1>main.obj : error LNK2001: unresolved external symbol "public: bool __cdecl boost::log::v2s_mt_nt5::core::get_logging_enabled(void)const " (?get_logging_enabled#core#v2s_mt_nt5#log#boost##QEBA_NXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: static class boost::shared_ptr<class boost::log::v2s_mt_nt5::core> __cdecl boost::log::v2s_mt_nt5::core::get(void)" (?get#core#v2s_mt_nt5#log#boost##SA?AV?$shared_ptr#Vcore#v2s_mt_nt5#log#boost###4#XZ)
1>main.obj : error LNK2001: unresolved external symbol "class boost::log::v2s_mt_nt5::basic_formatter<char> __cdecl boost::log::v2s_mt_nt5::parse_formatter<char>(char const *,char const *)" (??$parse_formatter#D#v2s_mt_nt5#log#boost##YA?AV?$basic_formatter#D#012#PEBD0#Z)
1>a.exe : fatal error LNK1120: 41 unresolved externals
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
I'm not really sure what is wrong. The libraries are there, the linker finds them. Just not symbols in them. Any tips?
Ok, figured it out. Problem was, that boost was compiled with _WIN32_WINNT 0x0601 while I was building with 0x0501. Just changed mine to 0x0601 as well and it linked fine.
But this program or application you created works in windows 7 or more. It does not supports for Windows XP.
If you want to create application that supports for windows XP, then you can use BOOST 1.58 version.
This version is last which supports from Windows XP. Then later versions supports more than windows XP (i.e.)From vista only.
I'm trying to compile the zeromq sources and I have the following error:
I'm using Visual studio 2013 update 4 / windows 7 x64
First of all I compile the libsodium library satisfactorily.
Then I link the libsodium header files directory path to additional dependencies and libsodium.lib to additional library directories. I also specify the name of library in additional dependencies.
I try to compile it under win32 architecture and x64 architecture but I get the same errors.
I know that a __imp prefix is used as a bridge to the function that I want to use so if I linked the libraries appropiately why do I get this error?
Console log:
1>Creating library E:\zmq\libzmq\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Debug\v120\dynamic\libzmq.lib and object E:\zmq\libzmq\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Debug\v120\dynamic\libzmq.exp
1>ctx.obj : error LNK2019: unresolved external symbol __imp__randombytes_close referenced in function "public: __thiscall zmq::ctx_t::~ctx_t(void)" (??1ctx_t#zmq##QAE#XZ)
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__sodium_init referenced in function "public: __thiscall zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t#zmq##QAE#ABUoptions_t#1##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__sodium_init
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_keypair referenced in function "public: __thiscall zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t#zmq##QAE#ABUoptions_t#1##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_keypair
1>zmq_utils.obj : error LNK2001: unresolved external symbol __imp__crypto_box_keypair
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_beforenm referenced in function "private: int __thiscall zmq::curve_client_t::process_welcome(unsigned char const *,unsigned int)" (?process_welcome#curve_client_t#zmq##AAEHPBEI#Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_beforenm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box referenced in function "private: int __thiscall zmq::curve_client_t::produce_hello(class zmq::msg_t *)" (?produce_hello#curve_client_t#zmq##AAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_open referenced in function "private: int __thiscall zmq::curve_client_t::process_welcome(unsigned char const *,unsigned int)" (?process_welcome#curve_client_t#zmq##AAEHPBEI#Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_open
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_afternm referenced in function "public: virtual int __thiscall zmq::curve_client_t::encode(class zmq::msg_t *)" (?encode#curve_client_t#zmq##UAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_afternm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_open_afternm referenced in function "public: virtual int __thiscall zmq::curve_client_t::decode(class zmq::msg_t *)" (?decode#curve_client_t#zmq##UAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_open_afternm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__randombytes referenced in function "private: int __thiscall zmq::curve_client_t::produce_initiate(class zmq::msg_t *)" (?produce_initiate#curve_client_t#zmq##AAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__randombytes
1>curve_server.obj : error LNK2019: unresolved external symbol __imp__crypto_secretbox referenced in function "private: int __thiscall zmq::curve_server_t::produce_welcome(class zmq::msg_t *)" (?produce_welcome#curve_server_t#zmq##AAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2019: unresolved external symbol __imp__crypto_secretbox_open referenced in function "private: int __thiscall zmq::curve_server_t::process_initiate(class zmq::msg_t *)" (?process_initiate#curve_server_t#zmq##AAEHPAVmsg_t#2##Z)
Thanks in advance.
You're probably compiling libsodium in a static way.
Try to compile it dinamically and link it again.
Such errors are also able to occur when you have a wrong set calling convention at your project.
I'm having some problems with using CEF in my application which uses the MD/MDd runtime library linking.
I have downloaded the latest build of CEF3 from cefbuilds.com and followed the instructions How to link CEF against a different run-time library.
I have built the "libcef_dll_wrapper" project after changing "Runtime Library" to "/MDd" and "Platform Toolset" to "v110" and then I've linked the resulting "libcef_dll_wrapper.lib" binary to my project.
However, when I try to build my project I get the following errors:
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol _cef_string_utf16_clear referenced in function "public: static void __cdecl CefBrowserSettingsTraits::clear(struct _cef_browser_settings_t *)" (?clear#CefBrowserSettingsTraits##SAXPAU_cef_browser_settings_t###Z)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol _cef_string_utf8_to_utf16 referenced in function "public: static bool __cdecl CefStringTraitsUTF16::from_string(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct _cef_string_utf16_t *)" (?from_string#CefStringTraitsUTF16##SA_NABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PAU_cef_string_utf16_t###Z)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol _cef_string_list_free referenced in function "public: static void __cdecl CefSettingsTraits::clear(struct _cef_settings_t *)" (?clear#CefSettingsTraits##SAXPAU_cef_settings_t###Z)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol "public: static bool __cdecl CefBrowser::CreateBrowser(class CefWindowInfo &,class CefRefPtr<class CefClient>,class CefStringBase<struct CefStringTraitsUTF16> const &,class CefStructBase<struct CefBrowserSettingsTraits> const &)" (?CreateBrowser#CefBrowser##SA_NAAVCefWindowInfo##V?$CefRefPtr#VCefClient####ABV?$CefStringBase#UCefStringTraitsUTF16####ABV?$CefStructBase#UCefBrowserSettingsTraits#####Z) referenced in function "public: void __thiscall caspar::html::html_producer::run(void)" (?run#html_producer#html#caspar##QAEXXZ)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol "bool __cdecl CefInitialize(class CefStructBase<struct CefSettingsTraits> const &,class CefRefPtr<class CefApp>)" (?CefInitialize##YA_NABV?$CefStructBase#UCefSettingsTraits####V?$CefRefPtr#VCefApp#####Z) referenced in function "public: void __thiscall caspar::html::html_producer::run(void)" (?run#html_producer#html#caspar##QAEXXZ)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_execute_process referenced in function "int __cdecl CefExecuteProcess(class CefMainArgs const &,class CefRefPtr<class CefApp>)" (?CefExecuteProcess##YAHABVCefMainArgs##V?$CefRefPtr#VCefApp#####Z)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_initialize referenced in function "bool __cdecl CefInitialize(class CefMainArgs const &,class CefStructBase<struct CefSettingsTraits> const &,class CefRefPtr<class CefApp>)" (?CefInitialize##YA_NABVCefMainArgs##ABV?$CefStructBase#UCefSettingsTraits####V?$CefRefPtr#VCefApp#####Z)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_shutdown referenced in function "void __cdecl CefShutdown(void)" (?CefShutdown##YAXXZ)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_do_message_loop_work referenced in function "void __cdecl CefDoMessageLoopWork(void)" (?CefDoMessageLoopWork##YAXXZ)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_run_message_loop referenced in function "void __cdecl CefRunMessageLoop(void)" (?CefRunMessageLoop##YAXXZ)
The full log can be found here.
Any ideas as to what I might be missing?
Are you also libcef.lib in the linker input?
Developing an app with wxWidgets even though im fairly new too the library, and need some help fixing these linker problem;
i tried google first with no luck.
1>mainwindow.obj : error LNK2001: unresolved external symbol "char const * const wxTreeListCtrlNameStr" (?wxTreeListCtrlNameStr##3QBDB)
1>mainwindow.obj : error LNK2001: unresolved external symbol "protected: virtual class wxEventHashTable & __thiscall wxTreeListCtrl::GetEventHashTable(void)const " (?GetEventHashTable#wxTreeListCtrl##MBEAAVwxEventHashTable##XZ)
1>mainwindow.obj : error LNK2001: unresolved external symbol "protected: virtual struct wxEventTable const * __thiscall wxTreeListCtrl::GetEventTable(void)const " (?GetEventTable#wxTreeListCtrl##MBEPBUwxEventTable##XZ)
1>mainwindow.obj : error LNK2001: unresolved external symbol "private: int __thiscall wxTreeListCtrl::DoInsertColumn(class wxString const &,int,int,enum wxAlignment,int)" (?DoInsertColumn#wxTreeListCtrl##AAEHABVwxString##HHW4wxAlignment##H#Z)
1>mainwindow.obj : error LNK2001: unresolved external symbol "private: virtual class wxWindowList __thiscall wxTreeListCtrl::GetCompositeWindowParts(void)const " (?GetCompositeWindowParts#wxTreeListCtrl##EBE?AVwxWindowList##XZ)
1>mainwindow.obj : error LNK2001: unresolved external symbol "private: void __thiscall wxTreeListCtrl::Init(void)" (?Init#wxTreeListCtrl##AAEXXZ)
1>mainwindow.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall wxTreeListCtrl::~wxTreeListCtrl(void)" (??1wxTreeListCtrl##UAE#XZ)
1>mainwindow.obj : error LNK2001: unresolved external symbol "public: bool __thiscall wxTreeListCtrl::Create(class wxWindow *,int,class wxPoint const &,class wxSize const &,long,class wxString const &)" (?Create#wxTreeListCtrl##QAE_NPAVwxWindow##HABVwxPoint##ABVwxSize##JABVwxString###Z)
i tried to format this into a code, but its so hard to do on this site
You need to include the advanced library in the list of wx libraries linked to.
This is mentioned in the wxTreeListCtrl documentation at http://docs.wxwidgets.org/trunk/classwx_tree_list_ctrl.html
The documentation of every wxwidgets class mentions which library needs to be linked with when you use the class.
This is the first time I have attempted to create a .dll, that will be used as a plugin to a 3rd party app.
I created a .dll project in VS210...New Project -> Win32 Console Application -> .dll + Empty Project options.
Then I added in the files I wanted to use and included the various include / dependency libs the code required. Furthermore, set the linker to include the output .lib
Configuration Properties -> Linker -> Advanced -> Import Library - $(OutDir)$(TargetName).lib
While the .lib is successfully compiled, as soon as VS tries to then build the .dll I get a load of "unresolved external symbol" errors relating to all the defined function names.
ClCompile:
SOMPlugin.cpp
Link:
Creating library F:\Data\My Documents\Visual Studio 2010\Projects\Plugin-SOM - Copy\Release\Plugin-SOM.lib and object F:\Data\My Documents\Visual Studio 2010\Projects\Plugin-SOM - Copy\Release\Plugin-SOM.exp
SOMPlugin.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall SOMPlugin::metaObject(void)const " (?metaObject#SOMPlugin##UBEPBUQMetaObject##XZ)
SOMPlugin.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall SOMPlugin::qt_metacast(char const *)" (?qt_metacast#SOMPlugin##UAEPAXPBD#Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall SOMPlugin::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#SOMPlugin##UAEHW4Call#QMetaObject##HPAPAX#Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall SOMPlugin::updateView(void)" (?updateView#SOMPlugin##MAEXXZ)
SOMPlugin.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall SOMPlugin::updatedObject(int,class UpdateType const &)" (?updatedObject#SOMPlugin##MAEXHABVUpdateType###Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall SOMPlugin::addToolbox(class QString,class QWidget *)" (?addToolbox#SOMPlugin##MAEXVQString##PAVQWidget###Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall SOMPlugin::log(class QString)" (?log#SOMPlugin##MAEXVQString###Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall SOMPlugin::log(enum Logtype,class QString)" (?log#SOMPlugin##MAEXW4Logtype##VQString###Z)
SOMPlugin.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall SOMPlugin::~SOMPlugin(void)" (??1SOMPlugin##UAE#XZ) referenced in function "public: virtual void * __thiscall SOMPlugin::`scalar deleting destructor'(unsigned int)" (??_GSOMPlugin##UAEPAXI#Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const SOMPlugin::staticMetaObject" (?staticMetaObject#SOMPlugin##2UQMetaObject##B)
F:\Data\My Documents\Visual Studio 2010\Projects\Plugin-SOM\Release\Plugin-SOM.dll : fatal error LNK1120: 9 unresolved externals
Any help would be much appreciated.
The lib will be generated even if you get linker errors. Let's look at one:
SOMPlugin.obj : error LNK2001: unresolved external symbol "public:
virtual struct QMetaObject const * __thiscall
SOMPlugin::metaObject(void)const "
(?metaObject#SOMPlugin##UBEPBUQMetaObject##XZ)
This is telling you that you haven't implemented the method SOMPlugin::metaObject(void)const. Have you?
The rest are similar, other than
SOMPlugin.obj : error LNK2001: unresolved external symbol "public:
static struct QMetaObject const SOMPlugin::staticMetaObject"
(?staticMetaObject#SOMPlugin##2UQMetaObject##B)
In this case, you need a definition for the static member outside the class definition, in an implementation file.