我曾经Cmake
定义folder paths
.
我有Config.in.h
文件,其中#cmakedefine
声明为
#cmakedefine CAFFE_MODEL_PATH
#cmakedefine CAFFE_MODEL_PATH
#cmakedefine CAFFE_TRAIN_MODEL
#cmakedefine MEAN_FILE
#cmakedefine LABEL_FILE
在我的CMakeLists.txt
,我做了
set(CAFFE_MODEL_PATH "" CACHE PATH "Path to a Caffe model")
set(CAFFE_TRAIN_MODEL "" CACHE PATH "Path to a trained model")
set(MEAN_FILE "" CACHE PATH "Path to the mean file all trained images")
set(LABEL_FILE "" CACHE PATH "Path to the mean file all trained images")
configure_file (
"${PROJECT_SOURCE_DIR}/Config.h.in"
"${PROJECT_SOURCE_DIR}/Config.h"
)
所以这Config.h
对那些有#defineCAFFE_MODEL_PATH, CAFFE_TRAIN_MODEL, MEAN_FILE, LABEL_FILE
。
但是当我在 main.cpp 文件中使用它们时
int main(void) {
::google::InitGoogleLogging("endtoenddetection");
string model_file = CAFFE_MODEL_PATH;
string trained_file = CAFFE_TRAIN_MODEL;
string mean_file = MEAN_FILE;
string label_file = LABEL_FILE;
}
我有错误
/home/Softwares/ReInspect/endtoendLstm/main.cpp:8:43: error: expected primary-expression before ‘;’ token
string model_file = CAFFE_MODEL_PATH;
^
/home/Softwares/ReInspect/endtoendLstm/main.cpp:9:44: error: expected primary-expression before ‘;’ token
string trained_file = CAFFE_TRAIN_MODEL;
^
/home/Softwares/ReInspect/endtoendLstm/main.cpp:10:36: error: expected primary-expression before ‘;’ token
string mean_file = MEAN_FILE;
^
/home/Softwares/ReInspect/endtoendLstm/main.cpp:11:37: error: expected primary-expression before ‘;’ token
string label_file = LABEL_FILE;