Qt 4.6.1
在以下 .pro 文件中,当我使用该语句时
sources = ef.cpp
我收到以下错误:
RInside.h: No such file or directory
然后,当我将 = 替换为 := 时,例如:
sources := ef.cpp
上面的错误消失了,我得到一个新的错误:
error: undefined reference to qMain(int, char**)
从这里:https ://stackoverflow.com/a/448939/462608
VARIABLE = value 变量的正常设置 - 在使用变量时递归扩展其中的值,而不是在声明变量时
VARIABLE := value 通过简单扩展内部值来设置变量-其中的值在声明时扩展。
我想了解这里发生了什么,以及解决方案是什么。
.cpp
#include <RInside.h>
int main(int argc, char *argv[])
{
RInside R(argc, argv);
R["txt"] = "Hello, world!\n";
R.parseEvalQ ("cat(txt)");
exit(0);
}
.pro
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
R_HOME := 'c:/R-2.15.1'
# Input
sources = ef.cpp
programs := $(sources:.cpp=)
## include headers and libraries for R
RCPPFLAGS := $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config --cppflags)
RLDFLAGS := $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config --ldflags)
RBLAS := $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config BLAS_LIBS)
RLAPACK := $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config LAPACK_LIBS)
## include headers and libraries for Rcpp interface classes
RCPPINCL := $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R $(R_ARCH) --vanilla
--slave)
RCPPLIBS := $(shell echo 'Rcpp:::LdFlags()' | $(R_HOME)/bin/R $(R_ARCH) --vanilla --slave)
## include headers and libraries for RInside embedding classes
RINSIDEINCL := $(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R $(R_ARCH) --vanilla --slave)
RINSIDELIBS := $(shell echo 'RInside:::LdFlags()' | $(R_HOME)/bin/R $(R_ARCH) --vanilla --slave)
## compiler etc settings used in default make rules
CXX := $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config CXX)
CPPFLAGS := -Wall $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config CPPFLAGS)
#CXXFLAGS := $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell $(R_HOME)/bin/R $(R_ARCH)
CMD config CXXFLAGS)
QMAKE_CXXFLAGS := $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config CXXFLAGS)
LDFLAGS = -s
QMAKE_LIBS := $(RLDFLAGS) $(RBLAS) $(RLAPACK) $(RINSIDELIBS) $(RCPPLIBS)
CC := $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config CXX)