2012-11-01 1 views
1

Qt는 다음 .PRO 파일에서 4.6.1= 오류 대 = 나는 문</p> <pre><code>sources = ef.cpp </code></pre> <p>I을 사용 qMain (INT, CHAR **)

에 정의되지 않은 참조 다음과 같은 오류를 얻을 :

RInside.h: No such file or directory 

enter image description here

을 다음 나는로 =를 교체 할 때 = 같은 :

sources := ef.cpp 

위의 오류가 사라지고, 나는 새로운 오류 얻을 : 여기에서

error: undefined reference to qMain(int, char**) 

enter image description here

을 : https://stackoverflow.com/a/448939/462608

VARIABLE = value Normal setting of a variable - values within it are recursively expanded when the variable is used, not when it's declared

VARIABLE := value Setting of a variable with simple expansion of the values inside - values within it are expanded at declaration time.

여기에 무슨 일이 일어나고 있는지 알고 싶습니다. 모자가 해결책이야.

통화 당

#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) 
+0

이미 변경 한 것처럼 보이면 링크 단계로 이동합니다. 'qMain (int, char **)'를 가지고 있습니까? 그리고 실제로 컴파일되고 있습니까? – cHao

+0

@cHao 이미 가지고있는 유일한 소스 코드를 게시했습니다. 나는 특별히 qMain을 어디에도 쓰지 않았다. 네가 뭔가 다른 것을 의미한다면, 분명히 말하십시오. –

+0

링커가 주요 기능을 찾을 수 없다는 것을 알 수 있습니다. 그것이 전혀 존재하지 않는다는 것을 의미하거나, 잘못된 이름을 가졌거나, 컴파일되는 파일에 없습니다. 주요 기능은 어디서 어떻게 정의되어 있습니까? n 당신이 가지고 있지 않다면, 어떻게이 물건들이 작동할까요? – cHao

답변

2

이 당신은 아마 Qt는 libs와에 연결하지 않도록 설정해야하며,이 Qt는 프로젝트처럼 보이지 않는다. QTCONFIG가 비어있는 것으로 설정 : 다른 한편으로는이 는 Qt는 라이브러리에 연결해야합니다 Qt는 프로젝트가

QT = 
CONFIG = 

경우, 문제가 당신이 QMAKE_LIBSQMAKE_CXXFLAGS 같은 중요한 변수를 덮어하고 있다는 점이다. :=이 아니라 +=을 사용하십시오. 또한 이 아니라 LIBS을 사용하십시오.