我得到一個C++源代碼和項目結構如下:如何使用arm-linux-gcc交叉編譯gmock?
|-+ ACode
|-+ src //include code
|-+ include //include .h file
|-+ test
|-+ CMakeLists.txt
.... //similar to the ACode
|-+ build
|-+ doc
|-+ ThirdParty
|-+ googletest-release-1.8.0
|-+ googlemock
|-+ googletest
|-+ CMakeLists.txt
|-+ MultipartParser
|-+ rapidjson
|-+ CMakeLists.txt
|-+ googletest.cmake
|-+ tests
|-+ CMakeLists.txt
我用的cmake - >化妝可以建立成功,可以執行在Linux平臺上的成功。
現在我想用arm-linux-gcc
交叉編譯它。
獲取錯誤信息修改項目的CMakeLists.txt文件之後。 的CMakeLists.txt文件中添加如下內容:
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_C_COMPILER "/../../toolschain/4.4.3/bin/arm-linux-gcc")
SET(CMAKE_CXX_COMPILER "/../../toolschain/4.4.3/bin/arm-linux-g++")
獲取錯誤消息而使用make命令:
Scanning dependencies of target gmock_main [ 1%] Building CXX object ThirdParty/googletest-release-1.8.0/googlemock/CMakeFiles/gmock_main.dir/__/googletest/src/gtest-all.cc.o [ 2%] Building CXX object ThirdParty/googletest-release-1.8.0/googlemock/CMakeFiles/gmock_main.dir/src/gmock-all.cc.o In file included from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock.h:58, from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/src/gmock-all.cc:40: /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-actions.h: In static member function 'static Result testing::internal::ReturnNullAction::Perform(const ArgumentTuple&)': /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-actions.h:631: error: 'nullptr' was not declared in this scope In file included from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-spec-builders.h:75, from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-generated-function-mockers.h:43, from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock.h:61, from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/src/gmock-all.cc:40: /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In member function 'bool testing::internal::IsNullMatcher::MatchAndExplain(const Pointer&, testing::MatchResultListener*) const': /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:983: error: 'nullptr' was not declared in this scope /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In member function 'bool testing::internal::NotNullMatcher::MatchAndExplain(const Pointer&, testing::MatchResultListener*) const': /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1003: error: 'nullptr' was not declared in this scope /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: At global scope: /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1560: sorry, unimplemented: cannot expand 'Tail ...' into a fixed-length argument list /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1561: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1561: error: 'ListType' in class 'int' does not name a type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1561: error: template argument 2 is invalid /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1561: error: expected '::' before 'ListType' /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In static member function 'static int testing::internal::MatcherList::BuildList(const Head&, const Tail& ...)': /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1568: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1568: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1568: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1568: error: 'BuildList' is not a member of 'int' /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In static member function 'static testing::Matcher testing::internal::MatcherList::CreateMatcher(const int&)': /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1578: error: request for member 'first' in 'matchers', which is of non-class type 'const int' /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'CreateMatcher' is not a member of 'int' /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1580: error: request for member 'second' in 'matchers', which is of non-class type 'const int' /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1577: error: expected primary-expression before '(' token /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1578: error: request for member 'first' in 'matchers', which is of non-class type 'const int' /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: 'CreateMatcher' is not a member of 'int' /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: expected primary-expression before ',' token /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1579: error: missing template arguments before '>' token /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1580: error: request for member 'second' in 'matchers', which is of non-class type 'const int' /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: At global scope: /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1623: sorry, unimplemented: cannot expand 'Args ...' into a fixed-length argument list /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1625: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1625: error: 'ListType' in class 'int' does not name a type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In constructor 'testing::internal::VariadicMatcher::VariadicMatcher(const Args& ...)': /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1611: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1611: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1611: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1611: error: 'BuildList' is not a member of 'int' /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: In member function 'testing::internal::VariadicMatcher::operator testing::Matcher() const': /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'int' is not a class type /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: 'CreateMatcher' is not a member of 'int' /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: expected primary-expression before ',' token /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1618: error: missing template arguments before '>' token /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h: At global scope: /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1631: error: expected unqualified-id before 'using' /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:1725: error: expected unqualified-id before 'using' In file included from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-spec-builders.h:75, from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-generated-function-mockers.h:43, from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock.h:61, from /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/src/gmock-all.cc:40: /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:4363: error: expected initializer before '<' token /../../Linux+C/Temp/20170414/alexa-client-sdk-master/ThirdParty/googletest-release-1.8.0/googlemock/include/gmock/gmock-matchers.h:4368: error: expected initializer before '<' token make[2]: * [ThirdParty/googletest-release-1.8.0/googlemock/CMakeFiles/gmock_main.dir/src/gmock-all.cc.o] Error 1 make[1]: * [ThirdParty/googletest-release-1.8.0/googlemock/CMakeFiles/gmock_main.dir/all] Error 2 make: *** [all] Error 2
誰能幫助我如何修改的CMakeLists.txt文件? 還是我錯過了什麼?