I have a future command-line program in Visual C++ 2010 environment. I employ MySQL++ library, that is built and installed properly.
First, I have some globals defined in stdafx.h (program is very simplistic so I basically used the file for all my header needs, and do not use any other header file. The header file has usual "#if !defined "... "#endif" wrapping. Linker complains:
Error 2 error LNK2005: "__int64 last_local_time" (?last_local_time@@3_JA) already defined in coreprocessing.obj C:\Tsukasa\ilya\DataImporter\DataImporter\stdafx.obj
Error 3 error LNK2005: "bool debug" (?debug@@3_NA) already defined in coreprocessing.obj C:\Tsukasa\ilya\DataImporter\DataImporter\stdafx.obj
Error 4 error LNK2005: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > user" (?user@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) already defined in coreprocessing.obj C:\Tsukasa\ilya\DataImporter\DataImporter\stdafx.obj
Error 5 error LNK2005: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > server" (?server@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) already defined in coreprocessing.obj C:\Tsukasa\ilya\DataImporter\DataImporter\stdafx.obj
other linker errors are related to Mysql++ library.
Error 9 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall mysqlpp::Query::`vbase destructor'(void)" (__imp_??_DQuery@mysqlpp@@QAEXXZ) referenced in function "class mysqlpp::Query * __cdecl connectToDb(void)" (?connectToDb@@YAPAVQuery@mysqlpp@@XZ) C:\Tsukasa\ilya\DataImporter\DataImporter\coreprocessing.obj
Error 10 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mysqlpp::DateTime::operator __int64(void)const " (__imp_??BDateTime@mysqlpp@@QBE_JXZ) referenced in function "class mysqlpp::Query * __cdecl connectToDb(void)" (?connectToDb@@YAPAVQuery@mysqlpp@@XZ) C:\Tsukasa\ilya\DataImporter\DataImporter\coreprocessing.obj
while in Properties "Library Directories" includes the path of LIB folder for MySQL++, configuration is Debug and I have the following files in the LIB folder: **mysqlpp_d.dll mysqlpp_d.lib **.
I appreciate if someone can help with the insights of what I did wrong.
The errors 9 and 10 were because I forgot to add library mysqlpp.lib/mysqlpp_d.lib in Project properties > Linker > Additional Dependencies.
So, adding pathes to VC directories to Includes and Libraries was not enough.