cmake编译时出现无法定义的问题。
Completed我自己创建了一个飞行控制程序,但是在编译过程中出现了无法定义的问题,我修改了cmakelist之后还是报了相同的错误,我又按照官网的cmakelist进行了修改,还是出错,请问我该如何解决这个问题。
cmake_minimum_required(VERSION 3.10.2)
project(GalaxyZ_cpp)
set(CMAKE_CXX_STANDARD 17)
set(INC_DIR include/djiosdk/)
set(LINK_DIR library)
include_directories(${INC_DIR})
link_directories(${LINK_DIR})
link_libraries(djiosdk-core)
set(INC_DIR include)
set(LINK_DIR library)
include_directories(${INC_DIR})
link_directories(${LINK_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -g -O0")
if(NOT ONBOARDSDK_SOURCE)
set(ONBOARDSDK_SOURCE "/home/pi/Onboard-SDK/osdk-core")
endif()
# Specify locations for osdk-core headers
include_directories(${ONBOARDSDK_SOURCE}/api/inc)
include_directories(${ONBOARDSDK_SOURCE}/utility/inc)
include_directories(${ONBOARDSDK_SOURCE}/hal/inc)
include_directories(${ONBOARDSDK_SOURCE}/protocol/inc)
include_directories(${ONBOARDSDK_SOURCE}/platform/linux/inc)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../hal)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../osal)
include_directories(include /usr/local/include)
include_directories(${ONBOARDSDK_SOURCE}/../sample/core/inc)
# User-code related project files
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../common)
FILE(GLOB SOURCE_FILES *.hpp *.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../common/dji_linux_environment.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../common/dji_linux_helpers.cpp
main.cpp
telemetry_sample.cpp
)
if (OSDK_HOTPLUG)
FILE(GLOB SOURCE_FILES ${SOURCE_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/../hal/hotplug/*.c)
endif ()
# Target and linking
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} djiosdk-core)
-
找到这些函数实现的源文件,然后再对应检查是否有将C/C++文件添加到源文件编译路径下。 ![](https://djisdksupport.zendesk.com/attachments/token/l03vxJ9XvhGGX1tIilw5zUIxZ/?name=image.png)
Please sign in to leave a comment.
Comments
1 comment