I work on porting to Windows a Linux C++ project. The buildsystem is cmake (2.8). I successfully built it using the nmake generator (Visual C++ 10) but its debug version does not start (see question 12215163), then I wanted to try it under Visual Studio but here the build fails at link time, not finding a template instantiation coming from a DLL.
You'll find below the outputs of the nmake and visual studio builds Please note that I tried an explicit template instantiation but it made no difference.
CMake and nmake generator (Visual C++ 10, x64, build type = Debug): it compiles
c:\PROGRA~2\MICROS~2.0\VC\bin\amd64\cl.exe /Zc:wchar_t- /EHsc /GR /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 -IE:\Projets\Amose\Sources\lima_linguisticprocessing\src -IC:\Qt\v4.8.2\include -IC:\Qt\v4.8.2\include\QtXmlPatterns -IC:\Qt\v4.8.2\include\QtXml -IC:\Qt\v4.8.2\include\QtCore -IC:\PROGRA~1\boost\BOOST_~1\include -Ic:\amose-debug\include -D WIN32 -Dlima_lp_analysisdict_EXPORTS -DQT_DLL -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DBOOST_ALL_DYN_LINK -DLIMA_ANALYSISDICT_EXPORTING -DQT_DEBUG /TP /FoCMakeFiles\lima-lp-analysisdict.dir\FsaAccessResource.cpp.obj /FdC:\amose-vcbuild\lima-lp-debug\src\linguisticProcessing\core\AnalysisDict\lima-lp-analysisdictd.pdb -c E:\Projets\Amose\Sources\lima_linguisticprocessing\src\linguisticProcessing\core\AnalysisDict\FsaAccessResource.cpp
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E vs_link_dll c:\PROGRA~2\MICROS~2.0\VC\bin\amd64\link.exe @CMakeFiles\lima-lp-analysisdict.dir\objects1.rsp /out:lima-lp-analysisdictd.dll /implib:lima-lp-analysisdictd.lib /pdb:C:\amose-vcbuild\lima-lp-debug\src\linguisticProcessing\core\AnalysisDict\lima-lp-analysisdictd.pdb /dll /version:1.0 /STACK:10000000 /machine:x64 /debug /INCREMENTAL -LIBPATH:C:\PROGRA~1\boost\BOOST_~1\lib -LIBPATH:c:\amose-debug\lib lima-common-factory.lib lima-common-misc.lib lima-common-data.lib lima-common-fsaaccess.lib lima-common-mediaticdata.lib lima-common-time.lib lima-common-xmlconfigurationfiles.lib lima-common-processunitframework.lib lima-common-mediaprocessors.lib ..\LinguisticProcessors\lima-lp-linguisticprocessorsd.lib ..\LinguisticResources\lima-lp-linguisticresourcesd.lib "C:\Program Files\boost\boost_1_50\lib\boost_regex-vc100-mt-gd-1_50.lib" "C:\Program Files\boost\boost_1_50\lib\boost_filesystem-vc100-mt-gd-1_50.lib" "C:\Program Files\boost\boost_1_50\lib\boost_program_options-vc100-mt-gd-1_50.lib" "C:\Program Files\boost\boost_1_50\lib\boost_system-vc100-mt-gd-1_50.lib" "C:\Program Files\boost\boost_1_50\lib\boost_thread-vc100-mt-gd-1_50.lib" "C:\Program Files\boost\boost_1_50\lib\boost_unit_test_framework-vc100-mt-gd-1_50.lib" C:\Qt\v4.8.2\lib\QtXmlPatternsd4.lib C:\Qt\v4.8.2\lib\QtXmld4.lib C:\Qt\v4.8.2\lib\QtNetworkd4.lib C:\Qt\v4.8.2\lib\QtCored4.lib lima-common-misc.lib lima-common-data.lib lima-common-mediaticdata.lib ..\LinguisticProcessors\lima-lp-linguisticprocessorsd.lib lima-common-factory.lib lima-common-time.lib lima-common-xmlconfigurationfiles.lib lima-common-processunitframework.lib lima-common-mediaprocessors.lib lima-common-qslog.lib "C:\Program Files\boost\boost_1_50\lib\boost_regex-vc100-mt-gd-1_50.lib" "C:\Program Files\boost\boost_1_50\lib\boost_filesystem-vc100-mt-gd-1_50.lib" "C:\Program Files\boost\boost_1_50\lib\boost_program_options-vc100-mt-gd-1_50.lib" "C:\Program Files\boost\boost_1_50\lib\boost_system-vc100-mt-gd-1_50.lib" "C:\Program Files\boost\boost_1_50\lib\boost_thread-vc100-mt-gd-1_50.lib" "C:\Program Files\boost\boost_1_50\lib\boost_unit_test_framework-vc100-mt-gd-1_50.lib" C:\Qt\v4.8.2\lib\QtXmlPatternsd4.lib C:\Qt\v4.8.2\lib\QtXmld4.lib C:\Qt\v4.8.2\lib\QtNetworkd4.lib C:\Qt\v4.8.2\lib\QtCored4.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib
CMake and Visual Studio generator (Visual C++ 10, x64, debug) : link fails
cl /c /IE:/Projets/Amose/Sources/lima_linguisticprocessing/src /IC:/Qt/v4.8.2/include /IC:/Qt/v4.8.2/include/QtXmlPatterns /IC:/Qt/v4.8.2/include/QtXml /IC:/Qt/v4.8.2/include/QtCore /I"C:/Program Files/boost/boost_1_50/include" /IC:/Program /IE:/Projets/Amose/Sources/lima_linguisticprocessing/Files/amosecommon/include /I"C:/amose-vc/include" /Zi /W1 /WX- /Od /Ob0 /D _DEBUG /D WIN32 /D QT_DLL /D QT_XMLPATTERNS_LIB /D QT_XML_LIB /D QT_CORE_LIB /D BOOST_ALL_DYN_LINK /D LIMA_ANALYSISDICT_EXPORTING /D QT_DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D lima_lp_analysisdict_EXPORTS /D _WINDLL /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t- /Zc:forScope /GR /Fo"lima-lp-analysisdict.dir\Debug\\" /Fd"C:/amose-vcbuild/lima-lp-vc/src/linguisticProcessing/core/AnalysisDict/Debug/lima-lp-analysisdictd.pdb" /Gd /TP /errorReport:prompt E:\Projets\Amose\Sources\lima_linguisticprocessing\src\linguisticProcessing\core\AnalysisDict\FsaAccessResource.cpp
(Link command line is not displayed in Visual Studio)
Création de la bibliothèque C:/amose-vcbuild/lima-lp-vc/src/linguisticProcessing/core/AnalysisDict/Debug/lima-lp-analysisdictd.lib et de l'objet C:/amose-vcbuild/lima-lp-vc/src/linguisticProcessing/core/AnalysisDict/Debug/lima-lp-analysisdictd.exp
2>FsaAccessResource.obj : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: void __cdecl Lima::Common::FsaAccess::FsaAccessReader16<class boost::adjacency_list<struct boost::vecS,struct boost::vecS,struct boost::bidirectionalS,struct boost::property<enum vertex_count_t,class std::vector<int,class std::allocator<int> >,struct boost::property<enum boost::vertex_name_t,unsigned long,struct boost::property<enum vertex_text_t,class QString,struct boost::no_property> > >,struct boost::no_property,struct boost::no_property,struct boost::listS> >::read(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?read@?$FsaAccessReader16@V?$adjacency_list@UvecS@boost@@U12@UbidirectionalS@2@U?$property@W4vertex_count_t@@V?$vector@HV?$allocator@H@std@@@std@@U?$property@W4vertex_name_t@boost@@KU?$property@W4vertex_text_t@@VQString@@Uno_property@boost@@@2@@boost@@@2@Uno_property@2@U52@UlistS@2@@boost@@@FsaAccess@Common@Lima@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) référencé dans la fonction "public: virtual void __cdecl Lima::LinguisticProcessing::AnalysisDict::FsaAccessResource::init(class Lima::Common::XMLConfigurationFiles::GroupConfigurationStructure &,class Lima::InitializableObjectManager<class Lima::LinguisticProcessing::AbstractResource,struct Lima::LinguisticProcessing::ResourceInitializationParameters> *)" (?init@FsaAccessResource@AnalysisDict@LinguisticProcessing@Lima@@UEAAXAEAVGroupConfigurationStructure@XMLConfigurationFiles@Common@4@PEAV?$InitializableObjectManager@VAbstractResource@LinguisticProcessing@Lima@@UResourceInitializationParameters@23@@4@@Z)