对符号'_ZN4Poco7Dynamic3VarD1Ev的未定义引用

问题描述 投票:0回答:1

我是qt和cmake的新手,正在尝试为使用opencv和poco库的应用程序编写gtest类。我已经在cmakelist中包含了所有必需的库,并且不断出现此错误

对符号'_ZN4Poco7Dynamic3VarD1Ev'的未定义引用] >>

以及以下错误消息:

错误添加符号:命令行缺少DSO

此错误实际上是什么意思?它是怎么发生的?

如果我没有提供足够的详细信息,请原谅我。请让我知道我还需要提供其他细节。

Ubuntu 16.04,OpenCV 3.4.3

以下是我的编译输出:


/usr/bin/ld: CMakeFiles/ipe_example.dir/main.cpp.o: undefined reference to symbol '_ZN4Poco7Dynamic3VarD1Ev'
/usr/local/lib/libPocoFoundation.so.61: error adding symbols: examples/commandline_app/CMakeFiles/ipe_example.dir/build.make:142: recipe for target 'examples/commandline_app/ipe_example' failed
CMakeFiles/Makefile2:85: recipe for target 'examples/commandline_app/CMakeFiles/ipe_example.dir/all' failed
Makefile:127: recipe for target 'all' failed
DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [examples/commandline_app/ipe_example] Error 1
make[1]: *** [examples/commandline_app/CMakeFiles/ipe_example.dir/all] Error 2
make: *** [all] Error 2
14:26:32: The process "/usr/bin/cmake" exited with code 2.
Error while building/deploying project ipe_cpp (kit: Desktop Qt 5.13.1 GCC 64bit)
When executing step "CMake Build" 

这是我的CMakeList.txt:

cmake_minimum_required (VERSION 2.8)

set (CMAKE_CXX_STANDARD 11)

project (image_process)

find_package(OpenCV REQUIRED )

message(STATUS "OpenCV version : ${OpenCV_VERSION}")
message(STATUS "OpenCV includes : ${OpenCV_INCLUDE_DIRS}")
message(STATUS "OpenCV libs : ${OpenCV_LIBS}")
message(STATUS "Poco includes : " $ENV{POCO_ROOT}/include )
message(STATUS "Poco libs : " /usr/local/lib )

include_directories(${OpenCV_INCLUDE_DIRS})
include_directories($ENV{POCO_ROOT}/include)
link_directories($ENV{POCO_ROOT}/lib)


add_subdirectory(src)
add_subdirectory(test)

Src CMakeList.txt


project (process)

file(GLOB SOURCE_FILES  "bridge/*.hpp"
                            "bridge/*.cpp"
                           "bridge/implementation/*.hpp"
                            "bridge/implementation/*.cpp"
                            "*.hpp" "*.cpp")


add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})

target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} -lPocoFoundation -lPocoJSON)

install(FILES parameter.hpp DESTINATION include)

install(TARGETS ${PROJECT_NAME} DESTINATION lib)

我是qt和cmake的新手,正在尝试为使用opencv和poco库的应用程序编写gtest类。我已经在cmakelist中包含了所有必需的库,并且我一直在获取它...

c++ qt opencv cmake googletest
1个回答
-1
投票

您可能会忘记链接某些库。

© www.soinside.com 2019 - 2024. All rights reserved.