我获得了一个使用Xerces-C++的旧C++项目的源代码,我正试图用CMAKE在CLion上构建该项目。OSx版本:Catalina。
我首先准备了旧项目上没有的cmakelists.txt。
我得到了这个构建异常:
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/miloscuculovic/CLionProjects/Test2/cmake-build-debug --target all -- -j 4 VERBOSE=1
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -S/Users/miloscuculovic/CLionProjects/Test2 -B/Users/miloscuculovic/CLionProjects/Test2/cmake-build-debug --check-build-system CMakeFiles/Makefile.cmake 0
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -E cmake_progress_start /Users/miloscuculovic/CLionProjects/Test2/cmake-build-debug/CMakeFiles /Users/miloscuculovic/CLionProjects/Test2/cmake-build-debug/CMakeFiles/progress.marks
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/Makefile2 all
/Library/Developer/CommandLineTools/usr/bin/make -f src/CMakeFiles/Test2.dir/build.make src/CMakeFiles/Test2.dir/depend
cd /Users/miloscuculovic/CLionProjects/Test2/cmake-build-debug && /Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -E cmake_depends "Unix Makefiles" /Users/miloscuculovic/CLionProjects/Test2 /Users/miloscuculovic/CLionProjects/Test2/src /Users/miloscuculovic/CLionProjects/Test2/cmake-build-debug /Users/miloscuculovic/CLionProjects/Test2/cmake-build-debug/src /Users/miloscuculovic/CLionProjects/Test2/cmake-build-debug/src/CMakeFiles/Test2.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make -f src/CMakeFiles/Test2.dir/build.make src/CMakeFiles/Test2.dir/build
[ 50%] Linking CXX executable Test2
cd /Users/miloscuculovic/CLionProjects/Test2/cmake-build-debug/src && /Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -E cmake_link_script CMakeFiles/Test2.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/c++ -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/Test2.dir/ComputeDelta.cpp.o -o Test2 -framework CoreFoundation -framework CoreFoundation -framework IOKit /usr/lib/libobjc.dylib /usr/lib/libcurl.dylib
Undefined symbols for architecture x86_64:
"xercesc_3_2::XMLAttDefList::serialize(xercesc_3_2::XSerializeEngine&)", referenced from:
vtable for xercesc_3_2::XMLAttDefList in ComputeDelta.cpp.o
"NodesManager::PrintStats()", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"NodesManager::FullBottomUp(int)", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"NodesManager::topdownMatch(int, int)", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"NodesManager::setUniqueIdHandler(UniqueIdHandler*)", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"NodesManager::registerResultDocument(XID_DOMDocument*)", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"NodesManager::registerSourceDocument(XID_DOMDocument*)", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"NodesManager::Optimize(int)", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"NodesManager::MatchById(int)", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"NodesManager::NodesManager()", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"NodesManager::~NodesManager()", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"DeltaConstructor::getDeltaDocument()", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"DeltaConstructor::constructDeltaDocument()", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"DeltaConstructor::DeltaConstructor(NodesManager*, char const*, XID_DOMDocument*, char const*, XID_DOMDocument*, bool)", referenced from:
XidXyDiff(XID_DOMDocument*, char const*, XID_DOMDocument*, char const*, bool, bool) in ComputeDelta.cpp.o
"xercesc_3_2::XMLAttDefList::getProtoType() const", referenced from:
vtable for xercesc_3_2::XMLAttDefList in ComputeDelta.cpp.o
"xercesc_3_2::XMLAttDefList::isSerializable() const", referenced from:
vtable for xercesc_3_2::XMLAttDefList in ComputeDelta.cpp.o
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/Test2] Error 1
make[1]: *** [src/CMakeFiles/Test2.dir/all] Error 2
make: *** [all] Error 2
cmake_minimum_required(VERSION 3.15)
project(Test2)
set(CMAKE_CXX_STANDARD 14)
add_subdirectory(src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(/usr/local/Cellar/xerces-c/3.2.2/include)
include_directories(/usr/local/Cellar/opencascade/7.3.0p3/include)
include_directories(/usr/local/Cellar/libuv/1.31.0/include)
add_executable(Test2 ComputeDelta.cpp)
set(STLINK_LIB_SHARED ${PROJECT_NAME})
find_library(ObjC objc)
find_library(Curl curl)
find_library(CoreServices CoreServices)
find_library(CoreFoundation CoreFoundation)
find_library(IOKit IOKit)
target_link_libraries(${STLINK_LIB_SHARED} ${CoreServices} ${CoreFoundation} ${IOKit} ${ObjC} ${Curl})
libuv和xerces-c都有一个pkg-config(.pc
)文件,因此可以将cmakelists.txt简化为以下内容。这就利用了findpkgconfig
模块,该模块将pkg-config文件转换为导入的目标(请参见“是时候做CMake right了”。这个导入的目标将自动知道要包括哪些头和要链接哪些库,您只需要使用target_link_libraries
与其链接即可。
include(FindPkgConfig)
pkg_check_modules(Xerces REQUIRED IMPORTED_TARGET xerces-c)
pkg_check_modules(LibUv REQUIRED IMPORTED_TARGET libuv)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(/usr/local/Cellar/opencascade/7.3.0p3/include)
add_library(libxyDelta STATIC
convertUTF.cpp
StringPusher.cpp
ComputeDelta.cpp
Diff_DeltaConstructor.pp
Diff_NodesManager.cpp
Diff_UniqueIdHandler.cpp
DeltaApply.cpp
DeltaException.cpp
DeltaManager.cpp
DeltaReverse.cpp
DeltaSortOperations.cpp
easy_css.cpp
lcss.cpp
lookup2.cpp
Tools.cpp
XID_map.cpp
XID_DOMDocument.cpp
XyDeltaFileImpl.cpp
XyDeltaDomImpl.cpp
XyInt.cpp
XyLatinStr.cpp
XyStr.cpp
XyStrDiff.cpp
XyStrDelta.cpp
XyUTF8Str.cpp)
set(STLINK_LIB_SHARED ${PROJECT_NAME})
find_library(ObjC objc)
find_library(Curl curl)
find_library(CoreServices CoreServices)
find_library(CoreFoundation CoreFoundation)
find_library(IOKit IOKit)
target_link_libraries(libxyDelta ${CoreServices} ${CoreFoundation} ${IOKit} ${ObjC} ${Curl})
target_link_libraries(libxyDelta PkgConfig::LibUv PkgConfig::Xerces)
add_executable(xydiff execComputeDelta.cpp)
target_link_libraries(xydiff libxyDelta)
add_executable(xydelta execDeltaApply.cpp)
target_link_libraries(xydelta libxyDelta)
我还将add_executable
更改为add_library
。这将消除关于xerces和main
的任何错误。这只会给您留下关于NodesManager
和DeltaconStructor
的错误,但我认为这些错误位于一个单独的.cpp
文件中,您忘记添加到目标中了。
您可能也可以删除大多数find_libraries
调用,但如果不知道源文件的外观,我就无法这样做。
我一直在尝试将Zendesk添加到我的swift项目中,并一直在尝试遵循以下步骤: https://developer.zendesk.com/embeddables/docs/ios_support_sdk/sdk_add#使用cocoapods添加-the-sdk-white 我已经使用以下命令添加了pod: 并将其添加到我的项目的: 但是,当我尝试运行我的项目时,我得到了这个错误: 我一直在
本文向大家介绍C++ 使用CMake生成构建环境,包括了C++ 使用CMake生成构建环境的使用技巧和注意事项,需要的朋友参考一下 示例 CMake可以从单个项目定义为几乎所有编译器或IDE生成构建环境。以下示例将演示如何将CMake文件添加到跨平台的“ Hello World” C ++代码。 CMake文件始终被命名为“ CMakeLists.txt”,并且应该已经存在于每个项目的根目录中(可
我正忙于将pre-build文件添加到我的项目中,以减小每个体系结构的Apk文件大小。 这篇文章在他的中添加了以下内容: 库提供以下文件: 我应该将文件按原样放置在我的文件夹中(不为每个体系结构创建文件夹),还是应该将其添加到文件夹中? <罢工> 以上哪一项 我应该使用文件来支持所有的体系结构吗? <罢工> 在这篇文章中,他还谈到了版本控制,这是必要的吗(我的应用程序是live的,我不想搞砸版本控
完整堆栈跟踪: Ld/users/danoved/library/developer/xcode/deriveddata/todobox-gmtanlmumdrkqactpypioaempcuc/build/products/debug-iphonesimulator/stash.appex/stash normal x86_64 cd/users/danoved/source/myproject
本文向大家介绍C语言结构体版学生成绩管理系统,包括了C语言结构体版学生成绩管理系统的使用技巧和注意事项,需要的朋友参考一下 本文实例为大家分享了C语言实现学生成绩管理系统的具体代码,供大家参考,具体内容如下 结构体版的学生成绩管理系统 主要功能有 按1 输入学生信息 按2 输出学生信息 按3 查询学生信息 按4 修改学生信息 按5 删除学生信息 按6 插入学生信息 按7 排序总成绩信息 学生信息主