Trouble compiling AdpCppSample in VC 2008

Trouble compiling AdpCppSample in VC 2008

imagem de Sam Morris
Hello, I'm having trouble compiling the AdpCppSample project in Visual Studio 2008. When I try to link the project I get the 1>adpcore.lib(CollectReportCrash.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::replace(class std::_String_const_iterator,class std::allocator >,class std::_String_const_iterator,class std::allocator >,class std::basic_string,class std::allocator > const &)" (__imp_?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@2@0ABV12@@Z) error that I've seen in other posts (I'm not running VC 2010, the /NODEFAULTLIB flag is not on, CRT is set to /MD) but none of the fixes seem applicable. I haven't changed any settings, the C/C++ command line settings are: /O2 /Oi /GL /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /FD /EHsc /MD /Gy /Fo"Release\\" /Fd"Release\vc90.pdb" /W3 /nologo /c /Zi /TP /errorReport:prompt and the Linker command line settings are: /OUT:"C:\Program Files\Intel\Intel Atom Developer Program SDK\Samples\cpp\Release\extendExample.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"../../../lib" /MANIFEST /MANIFESTFILE:"Release\extendExample.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Program Files\Intel\Intel Atom Developer Program SDK\Samples\cpp\Release\extendExample.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT adpcore.lib adpcppf.lib psapi.lib shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Any ideas what could be going wrong? Thanks, Sam
11 posts / 0 new
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.
imagem de ravenspoint

/MD means that the compiler of your code is expecting the CRT to be in a DLL.

However, I believe the SDK library has been compiled expecting the CRT in a static library.

Try this. Project | Properties | C++ | Code Generation | Runtime library | Multithreaded ( as opposed to DLL )

James

imagem de Sam Morris

Hey Ravenspoint, I'm still getting the same unresolved external symbol errors when I try that, but I get additional errors that in MSVCRT.lib and msvcprt.lib are already defined in various object files:

3>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
3>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _strcpy_s already defined in LIBCMT.lib(strcpy_s.obj)
3>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
3>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _memcpy_s already defined in LIBCMT.lib(memcpy_s.obj)
3>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _strcat_s already defined in LIBCMT.lib(strcat_s.obj)
3>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _sprintf_s already defined in LIBCMT.lib(sprintf.obj)
...

there are about 70 or so of these. And this is with a clean build, none of the old object files were laying around.

imagem de ravenspoint

It seems to me that your are still linking a mixture of DLL and static libraries.

I can't tell from here where the DLL is coming from, but you should be able to work it out by working carefully through your list of libraries.

imagem de BrianDevArch

Sam,

What version of Visual Studio 2008 are you using?
What OS version and service pack level is installed?
Are you using the latest version of the ATOM SDK?
Can the project find the LIBPATH? * (Go to settings and set a fully qualified path to the ATOM SDK Libraries)

Please let me know if any of those questions put you on the right path.

imagem de Sam Morris

Hey Raven, I'm not sure where to adjust the linking options for the libraries other than "right click project -> Properties -> Linker -> Input -> Additional Dependencies / Ignore All Default Libraries". I did notice the non-atom libraries mentioned in the command line for the linker (kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib), but I don't know where I would adjust those. Please forgive me if I'm being ignorant of visual studio, I don't use it regularly and when I do I normally run 2005.

Brian, I'm running Visual Studio 2008 version 9.0.21022.8 (I recently installed it after finding out it was the officially supported IDE) on an XP sp3 machine. I'm running version .92 of the SDK.

I tried adding "C:\Program Files\Intel\Intel Atom Developer Program SDK\lib" to Properties -> Linker -> General -> Additional Library Directories and now the command line lists /LIBPATH:"../../../lib" and LIBPATH:"C:\Program Files\Intel\Intel Atom Developer Program SDK\lib" but I still get this error:

2>adpcore.lib(CollectReportCrash.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::replace(class std::_String_const_iterator,class std::allocator >,class std::_String_const_iterator,class std::allocator >,class std::basic_string,class std::allocator > const &)" (__imp_?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@2@0ABV12@@Z)
2>C:\Program Files\Intel\Intel Atom Developer Program SDK\Samples\cpp\Release\delegationExampleWin32.exe : fatal error LNK1120: 1 unresolved externals

Thanks,
Sam

imagem de BrianDevArch

Sam,

Please try the following.

Ensure you have installed the latest version of the ATOM SDK
Unzip the sample to a new folder.
Go to the project properties and set the Library path to the correct path for your installed ATOM SDK library
Go to the project properties and set the Include path to the correct path for your installed ATOM SDK library

imagem de Sam Morris

Hey Brian, I tried compiling the sample from c:\adptest. At first I got

3>c:\adptest\crashreportexamplewin32\testapplication.h(18) : fatal error C1083: Cannot open include file: 'adpcppf.h': No such file or directory

errors along with the same unresolved external symbol errors I've been getting. Hopefully this sheds some light on things...after getting that error I edited Properties -> C/C++ -> General -> Additional Include Directories to include "C:\Program Files\Intel\Intel Atom Developer Program SDK\include" but it still couldn't find adpcppf.h:

1>------ Rebuild All started: Project: delegationExampleWin32, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'delegationExampleWin32', configuration 'Debug|Win32'
2>------ Rebuild All started: Project: extendExample, Configuration: Debug Win32 ------
3>------ Rebuild All started: Project: crashReportExampleWin32, Configuration: Debug Win32 ------
3>Deleting intermediate and output files for project 'crashReportExampleWin32', configuration 'Debug|Win32'
2>Deleting intermediate and output files for project 'extendExample', configuration 'Debug|Win32'
3>Compiling...
1>Compiling...
2>Compiling...
1>stdafx.cpp
3>stdafx.cpp
2>stdafx.cpp
1>Compiling...
3>Compiling...
1>DelegationExampleWin32.cpp
1>c:\adptest\delegationexamplewin32\delegationexamplewin32.cpp(15) : fatal error C1083: Cannot open include file: 'adpcppf.h': No such file or directory
1>Build log was saved at "file://c:\adptest\delegationExampleWin32\Debug\BuildLog.htm"
1>delegationExampleWin32 - 1 error(s), 0 warning(s)
3>crashReportExampleWin32.cpp
3>c:\adptest\crashreportexamplewin32\testapplication.h(18) : fatal error C1083: Cannot open include file: 'adpcppf.h': No such file or directory
3>ExampleCrashReport.cpp
3>c:\adptest\crashreportexamplewin32\examplecrashreport.h(18) : fatal error C1083: Cannot open include file: 'adpcppf.h': No such file or directory
3>TestApplication.cpp
3>c:\adptest\crashreportexamplewin32\testapplication.h(18) : fatal error C1083: Cannot open include file: 'adpcppf.h': No such file or directory
3>Generating Code...
3>Build log was saved at "file://c:\adptest\crashReportExampleWin32\Debug\BuildLog.htm"
3>crashReportExampleWin32 - 3 error(s), 0 warning(s)
2>Compiling...
2>main.cpp
2>SampleApplication.cpp
2>SampleComponent.cpp
2>Generating Code...
2>Compiling resources...
2>Compiling manifest to resources...
2>Linking...
2>LINK : warning LNK4044: unrecognized option '/MANIFESTUAC:level='asInvoker' uiAccess='false''; ignored
2>adpcored.lib(ADPSoapProxy.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)" (__imp_??1_Container_base_secure@std@@QAE@XZ) referenced in function "protected: __thiscall std::_Container_base_aux_alloc_empty >::~_Container_base_aux_alloc_empty >(void)" (??1?$_Container_base_aux_alloc_empty@V?$allocator@UMessageQueue@@@std@@@std@@IAE@XZ)
2>adpcppfd.lib(Component.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)" (__imp_??1_Container_base_secure@std@@QAE@XZ)
2>adpcppfd.lib(DefaultCrashReport.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)" (__imp_??1_Container_base_secure@std@@QAE@XZ)
2>adpcored.lib(ADPXmlWriter.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)" (__imp_??1_Container_base_secure@std@@QAE@XZ)
2>adpcored.lib(ADPSoapProxy.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base_secure::_Container_base_secure(void)" (__imp_??0_Container_base_secure@std@@QAE@XZ) referenced in function "protected: __thiscall std::_Container_base_aux_alloc_empty >::_Container_base_aux_alloc_empty >(class std::allocator)" (??0?$_Container_base_aux_alloc_empty@V?$allocator@UMessageQueue@@@std@@@std@@IAE@V?$allocator@UMessageQueue@@@1@@Z)
2>adpcppfd.lib(Component.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base_secure::_Container_base_secure(void)" (__imp_??0_Container_base_secure@std@@QAE@XZ)
2>adpcppfd.lib(DefaultCrashReport.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base_secure::_Container_base_secure(void)" (__imp_??0_Container_base_secure@std@@QAE@XZ)
2>adpcored.lib(ADPXmlWriter.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base_secure::_Container_base_secure(void)" (__imp_??0_Container_base_secure@std@@QAE@XZ)
2>adpcored.lib(CollectReportCrash.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::replace(class std::_String_const_iterator,class std::allocator >,class std::_String_const_iterator,class std::allocator >,class std::basic_string,class std::allocator > const &)" (__imp_?replace@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@2@0ABV12@@Z) referenced in function "public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::_Replace,class std::allocator > >(class std::_String_const_iterator,class std::allocator >,class std::_String_const_iterator,class std::allocator >,class std::_String_iterator,class std::allocator >,class std::_String_iterator,class std::allocator >,struct std::input_iterator_tag)" (??$_Replace@V?$_String_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@1@0V?$_String_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@1Uinput_iterator_tag@1@@Z)
2>adpcored.lib(ADPXmlWriter.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (__imp_?_Orphan_all@_Container_base_secure@std@@QBEXXZ) referenced in function "public: class std::vector > & __thiscall std::vector >::operator=(class std::vector > const &)" (??4?$vector@VXmlAttribute@adp@intel@com@@V?$allocator@VXmlAttribute@adp@intel@com@@@std@@@std@@QAEAAV01@ABV01@@Z)
2>C:\adptest\Debug\extendExample.exe : fatal error LNK1120: 4 unresolved externals
2>Build log was saved at "file://c:\adptest\extendExample\Debug\BuildLog.htm"
2>extendExample - 11 error(s), 1 warning(s)

imagem de BrianDevArch

Sam,

Please zip the project and post it for download. I will have a quick look and get to the bottom of this for you.

imagem de Sam Morris

Well, I got the examples to compile on a separate machine after installing visual studio 2008, the windows sdk and the atom sdk. I'm going to mess around with reinstalling the sdks on my personal machine to see if I can find a fix. If I do I'll be sure to post it. In the meantime I can move along on this other box. Thanks!

imagem de BrianDevArch

Good to hear. Best of luck in this exciting opportunity.

Faça login para deixar um comentário.