I've been working with boost under linux for awhile now, but I will soon be working on a Windows project, so I decided to setup Boost for windows, and get it working with QtCreator (also worked with under linux).
So, downloaded and built the windows boost libs and went to QtCreator to try them out under windows, and I've been somewhat perplexed.
main.cpp
#include <iostream>
#include <vector>
#include <boost/timer/timer.hpp>
using namespace std;
vector<int> f();
int main()
{
cout << "Hello World!" << endl;
vector<int> r;
{
boost::timer::auto_cpu_timer ct;
r = f();
}
return 0;
}
vector<int> f() {
vector<int> result;
for (auto i = 0U; i < 10000; i++) {
result.push_back(i);
}
return result;
}
test.pro
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
DEFINES += BOOST_ALL_NO_LIB
INCLUDEPATH+= C:/boost/boost_1_57_0/
LIBS += -L$$quote(C:\boost\boost_1_57_0\stage\lib) -llibboost_timer-vc120-mt-1_57 -llibboost_system-vc120-mt-1_57
include(deployment.pri)
qtcAddDeployment()
Now, I've tried -lots- of variations on the libs and the 'define' is recent, but every time, I get unresolved symbol issues:
main.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat@system@boost@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'errno_ecat''(void)" (??__Eerrno_ecat@system@boost@@YAXXZ)
main.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::timer::auto_cpu_timer::auto_cpu_timer(short)" (??0auto_cpu_timer@timer@boost@@QEAA@F@Z) referenced in function main
main.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::timer::auto_cpu_timer::~auto_cpu_timer(void)" (??1auto_cpu_timer@timer@boost@@QEAA@XZ) referenced in function main
Now, from what I've read, it seems like I shouldn't have to even state which libraries to import from boost... but that doesn't work either.
EDIT: Tried with the /VERBOSE flag set in for the linker, and its very strange; the bits that stand out are:
Referenced in kernel32.lib(KERNEL32.dll)
Loaded kernel32.lib(KERNEL32.dll)
Searching C:\boost\boost_1_57_0\stage\lib\libboost_timer-vc120-mt-1_57.lib:
Searching C:\boost\boost_1_57_0\stage\lib\libboost_system-vc120-mt-1_57.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\amd64\msvcprtd.lib:
Searching C:\boost\boost_1_57_0\stage\lib\libboost_timer-vc120-mt-gd-1_57.lib:
Searching C:\boost\boost_1_57_0\stage\lib\libboost_chrono-vc120-mt-gd-1_57.lib:
Searching C:\boost\boost_1_57_0\stage\lib\libboost_system-vc120-mt-gd-1_57.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\amd64\MSVCRTD.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\amd64\OLDNAMES.lib:
Finished searching libraries
Finished pass 1
Searching libraries
Searching C:\boost\boost_1_57_0\stage\lib\libboost_timer-vc120-mt-1_57.lib:
Searching C:\boost\boost_1_57_0\stage\lib\libboost_system-vc120-mt-1_57.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\amd64\msvcprtd.lib:
Searching C:\boost\boost_1_57_0\stage\lib\libboost_timer-vc120-mt-gd-1_57.lib:
Searching C:\boost\boost_1_57_0\stage\lib\libboost_chrono-vc120-mt-gd-1_57.lib:
Searching C:\boost\boost_1_57_0\stage\lib\libboost_system-vc120-mt-gd-1_57.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\amd64\MSVCRTD.lib:
Found _load_config_used
Loaded MSVCRTD.lib(loadcfg.obj)
Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\amd64\OLDNAMES.lib:
Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64\kernel32.lib:
and
Unused libraries:
C:\boost\boost_1_57_0\stage\lib\libboost_timer-vc120-mt-1_57.lib
C:\boost\boost_1_57_0\stage\lib\libboost_system-vc120-mt-1_57.lib
C:\boost\boost_1_57_0\stage\lib\libboost_timer-vc120-mt-gd-1_57.lib
C:\boost\boost_1_57_0\stage\lib\libboost_chrono-vc120-mt-gd-1_57.lib
C:\boost\boost_1_57_0\stage\lib\libboost_system-vc120-mt-gd-1_57.lib
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\amd64\OLDNAMES.lib
So, clearly its located and looked at the .lib files, and even noticed the extra includes of the libs I asked for, but not located the code objects to link up with.
Possibly something to do with being on Windows 64? I assumed boost would build as x64 on here, but maybe not. Someone suggested trying the pre-built binaries, will have a look for them.