How to fix Cmake build errors?
I am trying to build visual studio project. I am able to generate the dll
files. If i try to build the test cases (gtest) it is giving the fallowing
errors. To solve this problem what i need to change in CMakeLists.txt
file.
Compiling...
MuscleSCardOperations.cpp
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xlocale(342) :
warning C4530: C++ exception handler used, but unwind semantics are not
enabled. Specify /EHsc
main.cpp
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xlocale(342) :
warning C4530: C++ exception handler used, but unwind semantics are not
enabled. Specify /EHsc
Generating Code...
Performing Pre-Link Event...
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
gtestd.lib(gtest-all.obj) : warning LNK4229: invalid directive
'/FAILIFMISMATCH:_MSC_VER=1600' encountered; ignored
gtestd.lib(gtest-all.obj) : warning LNK4229: invalid directive
'/FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2' encountered; ignored
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_strchr imported in function "public: static class
testing::internal::String __cdecl
testing::internal::UnitTestOptions::GetOutputFormat(void)"
(?GetOutputFormat@UnitTestOptions@internal@testing@@SA?AVString@23@XZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_isspace imported in function "bool __cdecl
testing::internal::IsSpace(char)" (?IsSpace@internal@testing@@YA_ND@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_wcslen imported in function "class testing::internal::String __cdecl
testing::internal::WideStringToUtf8(wchar_t const *,int)"
(?WideStringToUtf8@internal@testing@@YA?AVString@12@PB_WH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ (public: virtual
__thiscall std::basic_ios >::~basic_ios >(void)) imported in function
"public: void __thiscall std::basic_stringstream,class std::allocator
>::`vbase destructor'(void)"
(??_D?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
__stricmp imported in function "int __cdecl
testing::internal::posix::StrCaseCmp(char const *,char const *)"
(?StrCaseCmp@posix@internal@testing@@YAHPBD0@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol _abort
imported in function "void __cdecl testing::internal::posix::Abort(void)"
(?Abort@posix@internal@testing@@YAXXZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
??1_Lockit@std@@QAE@XZ (public: __thiscall std::_Lockit::~_Lockit(void))
imported in function "public: __thiscall
std::_Iterator_base12::~_Iterator_base12(void)"
(??1_Iterator_base12@std@@QAE@XZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
??0_Lockit@std@@QAE@H@Z (public: __thiscall std::_Lockit::_Lockit(int))
imported in function "public: __thiscall
std::_Iterator_base12::~_Iterator_base12(void)"
(??1_Iterator_base12@std@@QAE@XZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
___iob_func imported in function "void __cdecl
testing::internal::ReportInvalidTestCaseType(char const *,char const
*,int)" (?ReportInvalidTestCaseType@internal@testing@@YAXPBD0H@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_fflush imported in function "void __cdecl
testing::internal::ColoredPrintf(enum testing::internal::GTestColor,char
const *,...)" (?ColoredPrintf@internal@testing@@YAXW4GTestColor@12@PBDZZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
__isatty imported in function "int __cdecl
testing::internal::posix::IsATTY(int)"
(?IsATTY@posix@internal@testing@@YAHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
__fileno imported in function "int __cdecl
testing::internal::posix::FileNo(struct _iobuf *)"
(?FileNo@posix@internal@testing@@YAHPAU_iobuf@@@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_getenv imported in function "char const * __cdecl
testing::internal::posix::GetEnv(char const *)"
(?GetEnv@posix@internal@testing@@YAPBDPBD@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol _exit
imported in function "public: __thiscall
testing::internal::XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(char
const *)" (??0XmlUnitTestResultPrinter@internal@testing@@QAE@PBD@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_fclose imported in function "public: virtual void __thiscall
testing::internal::XmlUnitTestResultPrinter::OnTestIterationEnd(class
testing::UnitTest const &,int)"
(?OnTestIterationEnd@XmlUnitTestResultPrinter@internal@testing@@UAEXABVUnitTest@3@H@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
??0exception@std@@QAE@ABV01@@Z (public: __thiscall
std::exception::exception(class std::exception const &)) imported in
function "public: __thiscall std::runtime_error::runtime_error(class
std::runtime_error const &)" (??0runtime_error@std@@QAE@ABV01@@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
??1exception@std@@UAE@XZ (public: virtual __thiscall
std::exception::~exception(void)) imported in function "public: virtual
__thiscall std::runtime_error::~runtime_error(void)"
(??1runtime_error@std@@UAE@XZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
??0exception@std@@QAE@ABQBD@Z (public: __thiscall
std::exception::exception(char const * const &)) imported in function
"public: __thiscall std::runtime_error::runtime_error(char const *)"
(??0runtime_error@std@@QAE@PBD@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
__set_abort_behavior imported in function "public: int __thiscall
testing::UnitTest::Run(void)" (?Run@UnitTest@testing@@QAEHXZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
__set_error_mode imported in function "public: int __thiscall
testing::UnitTest::Run(void)" (?Run@UnitTest@testing@@QAEHXZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_strncmp imported in function "bool __cdecl
testing::internal::SkipPrefix(char const *,char const * *)"
(?SkipPrefix@internal@testing@@YA_NPBDPAPBD@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol __exit
imported in function "void __cdecl testing::internal::DeathTestAbort(class
testing::internal::String const &)"
(?DeathTestAbort@internal@testing@@YAXABVString@12@@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
__errno imported in function "class testing::internal::String __cdecl
testing::internal::GetLastErrnoDescription(void)"
(?GetLastErrnoDescription@internal@testing@@YA?AVString@12@XZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
__open_osfhandle imported in function "public: virtual enum
testing::internal::DeathTest::TestRole __thiscall
testing::internal::WindowsDeathTest::AssumeRole(void)"
(?AssumeRole@WindowsDeathTest@internal@testing@@UAE?AW4TestRole@DeathTest@23@XZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_strrchr imported in function "private: char const * __thiscall
testing::internal::FilePath::FindLastPathSeparator(void)const "
(?FindLastPathSeparator@FilePath@internal@testing@@ABEPBDXZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol _free
imported in function "public: __thiscall testing::internal::RE::~RE(void)"
(??1RE@internal@testing@@QAE@XZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_malloc imported in function "private: void __thiscall
testing::internal::RE::Init(char const *)"
(?Init@RE@internal@testing@@AAEXPBD@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
__strdup imported in function "char * __cdecl
testing::internal::posix::StrDup(char const *)"
(?StrDup@posix@internal@testing@@YAPADPBD@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_strtol imported in function "bool __cdecl
testing::internal::ParseInt32(class testing::Message const &,char const
*,int *)" (?ParseInt32@internal@testing@@YA_NABVMessage@2@PBDPAH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_isxdigit imported in function "bool __cdecl
testing::internal::IsXDigit(char)" (?IsXDigit@internal@testing@@YA_ND@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
__invalid_parameter imported in function "public: char const & __thiscall
std::_String_const_iterator,class std::allocator >::operator*(void)const "
(??D?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDXZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UAE@XZ (public: virtual
__thiscall std::basic_iostream >::~basic_iostream >(void)) imported in
function
__unwindfunclet$??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z$0
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z
(public: __thiscall std::basic_iostream >::basic_iostream >(class
std::basic_streambuf > *)) imported in function "public: __thiscall
std::basic_stringstream,class std::allocator >::basic_stringstream,class
std::allocator >(int)"
(??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAE@XZ (protected: __thiscall
std::basic_ios >::basic_ios >(void)) imported in function "public:
__thiscall std::basic_stringstream,class std::allocator
>::basic_stringstream,class std::allocator >(int)"
(??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ (public: virtual
__thiscall std::basic_streambuf >::~basic_streambuf >(void)) imported in
function "public: virtual __thiscall std::basic_stringbuf,class
std::allocator >::~basic_stringbuf,class std::allocator >(void)"
(??1?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ (protected:
char * __thiscall std::basic_streambuf >::gptr(void)const ) imported in
function "protected: virtual int __thiscall std::basic_stringbuf,class
std::allocator >::overflow(int)"
(?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z
(protected: void __thiscall std::basic_streambuf >::setg(char *,char
*,char *)) imported in function "protected: virtual int __thiscall
std::basic_stringbuf,class std::allocator >::overflow(int)"
(?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD0@Z
(protected: void __thiscall std::basic_streambuf >::setp(char *,char *))
imported in function "protected: virtual int __thiscall
std::basic_stringbuf,class std::allocator >::overflow(int)"
(?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ (protected:
char * __thiscall std::basic_streambuf >::eback(void)const ) imported in
function "protected: virtual int __thiscall std::basic_stringbuf,class
std::allocator >::overflow(int)"
(?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ
(protected: char * __thiscall std::basic_streambuf >::_Pninc(void))
imported in function "protected: virtual int __thiscall
std::basic_stringbuf,class std::allocator >::overflow(int)"
(?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z
(protected: void __thiscall std::basic_streambuf >::setp(char *,char
*,char *)) imported in function "protected: virtual int __thiscall
std::basic_stringbuf,class std::allocator >::overflow(int)"
(?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ (protected:
char * __thiscall std::basic_streambuf >::pbase(void)const ) imported in
function "protected: virtual int __thiscall std::basic_stringbuf,class
std::allocator >::overflow(int)"
(?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ (protected:
char * __thiscall std::basic_streambuf >::epptr(void)const ) imported in
function "protected: virtual int __thiscall std::basic_stringbuf,class
std::allocator >::overflow(int)"
(?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ (protected:
char * __thiscall std::basic_streambuf >::pptr(void)const ) imported in
function "protected: virtual int __thiscall std::basic_stringbuf,class
std::allocator >::overflow(int)"
(?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z (protected:
void __thiscall std::basic_streambuf >::gbump(int)) imported in function
"protected: virtual int __thiscall std::basic_stringbuf,class
std::allocator >::pbackfail(int)"
(?pbackfail@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ (protected:
char * __thiscall std::basic_streambuf >::egptr(void)const ) imported in
function "protected: virtual int __thiscall std::basic_stringbuf,class
std::allocator >::underflow(void)"
(?underflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHXZ)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z (protected:
void __thiscall std::basic_streambuf >::pbump(int)) imported in function
"protected: virtual class std::fpos __thiscall std::basic_stringbuf,class
std::allocator >::seekoff(__int64,int,int)"
(?seekoff@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAE?AV?$fpos@H@2@_JHH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_memmove imported in function "public: static char * __cdecl
std::char_traits::move(char *,char const *,unsigned int)"
(?move@?$char_traits@D@std@@SAPADPADPBDI@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ (protected:
__thiscall std::basic_streambuf >::basic_streambuf >(void)) imported in
function "public: __thiscall std::basic_stringbuf,class std::allocator
>::basic_stringbuf,class std::allocator >(int)"
(??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z (public: void
__thiscall std::basic_ios >::setstate(int,bool)) imported in function
__catch$??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z$0
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
__strtoui64 imported in function "bool __cdecl
testing::internal::ParseNaturalNumber(class std::basic_string,class
std::allocator > const &,int *)"
(??$ParseNaturalNumber@H@internal@testing@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAH@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
_isdigit imported in function "bool __cdecl
testing::internal::IsDigit(char)" (?IsDigit@internal@testing@@YA_ND@Z)
gtestd.lib(gtest-all.obj) : warning LNK4217: locally defined symbol
?setbase@std@@YA?AU?$_Smanip@H@1@H@Z (struct std::_Smanip __cdecl
std::setbase(int)) imported in function "class testing::internal::String *
__cdecl testing::FormatSehExceptionMessage(unsigned long,char const *)"
(?FormatSehExceptionMessage@testing@@YAPAVString@internal@1@KPBD@Z)
OLDNAMES.lib(read.obi) : warning LNK4049: locally defined symbol __read
imported
OLDNAMES.lib(close.obi) : warning LNK4049: locally defined symbol __close
imported
OLDNAMES.lib(write.obi) : warning LNK4049: locally defined symbol __write
imported
gtestd.lib(gtest-all.obj) : error LNK2019: unresolved external symbol
"__declspec(dllimport) public: class std::basic_ostream > & __thiscall
std::basic_ostream >::operator<<(unsigned int)"
(__imp_??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@I@Z)
referenced in function "public: unsigned int __thiscall
testing::internal::Random::Generate(unsigned int)"
(?Generate@Random@internal@testing@@QAEII@Z)
............
............
..............
my CMakeLists.txt is:
####################################################################
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(MySCardApi C)
CMAKE_POLICY(SET CMP0015 NEW)
INCLUDE_DIRECTORIES(MySCardApi/trunk/src/include
MQSCardApi/trunk/ext/include)
LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/MySCardApi/trunk/build/lib
${CMAKE_SOURCE_DIR}/MySCardApi/trunk/ext/lib
${CMAKE_SOURCE_DIR}/MySCardApi/trunk/ext/lib/openssl_x32
${CMAKE_SOURCE_DIR}/MySCardApi/trunk/src/CMakeBuild/build/lib)
AUX_SOURCE_DIRECTORY(MuscleSCardApi Muscle_Lib_Src_Dir)
ADD_LIBRARY(MuscleSCardApi SHARED ${Muscle_Lib_Src_Dir}
${CMAKE_SOURCE_DIR}/MySCardApi/trunk/src/MuscleSCardApi/MuscleCardApi.def)
TARGET_LINK_LIBRARIES(MuscleSCardApi
Winscard.lib
shlwapi.lib
libeay32.lib
ssleay32.lib
Crypt32.lib)
SET_TARGET_PROPERTIES(MuscleSCardApi PROPERTIES
LINKER_LANGUAGE CPP
RUNTIME_OUTPUT_DIRECTORY bin
RUNTIME_OUTPUT_DIRECTORY_DEBUG bin
RUNTIME_OUTPUT_NAME
MuscleSCardApi_32d
ARCHIVE_OUTPUT_DIRECTORY lib
ARCHIVE_OUTPUT_DIRECTORY_DEBUG lib
OUTPUT_NAME MuscleSCardApi_32d)
SET(CMAKE_EXE_LINKER_FLAGS /NODEFAULTLIB:\"msvcprtd.lib,MSVCRTD.lib\")
AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/MQSCardApi/trunk/test/MuscleSCardApiTest
MuscleTest_Lib_Src_Dir)
ADD_EXECUTABLE(MuscleSCardApiTest ${MuscleTest_Lib_Src_Dir})
TARGET_LINK_LIBRARIES(MuscleSCardApiTest
MuscleSCardApi_32d.lib
gtestd.lib)
SET_TARGET_PROPERTIES(MuscleSCardApiTest PROPERTIES
LINKER_LANGUAGE CPP
RUNTIME_OUTPUT_DIRECTORY bin
RUNTIME_OUTPUT_DIRECTORY_DEBUG bin
RUNTIME_OUTPUT_NAME
MuscleSCardApiTest_32d
ARCHIVE_OUTPUT_DIRECTORY lib
ARCHIVE_OUTPUT_DIRECTORY_DEBUG lib
OUTPUT_NAME MuscleSCardApiTest_32d)
No comments:
Post a Comment