【发布时间】:2012-01-27 12:31:08
【问题描述】:
当我尝试使用make 编译我的程序时,我得到一个未定义的对主要错误的引用。然而,main 存在于我的 src 目录中,我对自己做错了什么感到迷茫。
我假设add_executable([title] [source]) 是用于将源文件添加到编译的命令。
基于 cmake 教程
cmake_minimum_required(VERSION 2.6)
project(opengl_02)
add_executable(opengl_02 opengl_02.cpp)
add_executable(main main.cpp)
add_executable(geometrics geometrics.cpp)
set (opengl_02_version_major 1)
set (openfl_02_version_minor 0)
#configure the header file to pass some of the CMake settings
#to the source code
configure_file(
"${PROJECT_SOURCE_DIR}/opengl_02_config.h.in"
"${PROJECT_BINARY_DIR}/opengl_02_config.h"
)
#add the binary tree to the search path for include files
#so that it will find tutorialconfig.h
include_directories("{PROJECT_BINARY_DIR}")
add_executable(opengl_02_config opengl_02_config.cpp)
问题
为什么我的主文件没有被引用?
【问题讨论】:
标签: c++ compilation cmake linker-errors