2012-10-11 3 views
0

Makefile이 .cu (CUDA) 파일을 컴파일하려고하면 오류가 생성됩니다.컴파일 오류 : g ++ - v4/tr1_impl/type_traits (226) : 오류 : 식별자가 필요함

우리는 이것을 위해 특별히 만들어진 .hpp로 이것을 컴파일 할 수있었습니다. 우리가 기존 헤더에서 컴파일하려고 할 때, 그것은 .cpp (다른 말로 .hpp, .cpp와 .cu)를 가지고 있기 때문에,이 이상한 컴파일 오류가 계속 발생합니다. 가독성을 위해서

,이 디렉토리로 시작하는 모든 후속 메시지 :

/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/include/g++-v4/tr1_impl/ 

메시지 :

type_traits(226): error: expected an identifier 
type_traits(227): error: expected a ")" 
type_traits(227): error: a template argument list is not allowed in a declaration of a primary template 

type_traits(229): error: expected an identifier 
type_traits(230): error: expected a ")" 
type_traits(230): error: a template argument list is not allowed in a declaration of a primary template 

type_traits(232): error: expected an identifier 
type_traits(233): error: expected a ")" 
type_traits(233): error: expected a ">" 

type_traits(235): error: expected an identifier 
type_traits(236): error: expected a ")" 
type_traits(236): error: expected a ">" 

type_traits(238): error: expected an identifier 
type_traits(239): error: expected a ")" 
type_traits(239): error: expected a ">" 

type_traits(241): error: expected an identifier 
type_traits(242): error: expected a ")" 
type_traits(242): error: expected a ">" 

type_traits(244): error: expected an identifier 
type_traits(245): error: expected a ")" 
type_traits(245): error: expected a ">" 

type_traits(247): error: expected an identifier 
type_traits(248): error: expected a ")" 
type_traits(248): error: expected a ">" 

는 것이 가능 .CU 단일 .HPP을하는 것입니다 그것 뒤에 .cpp?

+1

예 .nvcc에서 빌드 할 수없는 파일이 .hpp에 포함되어있는 경우 .cu 파일에서 포함 할 수 없습니다. 이 파일들 주위에서'#ifndef __CUDACC__'를 사용할 수 있기 때문에 nvcc로 .cu를 컴파일 할 때 포함되지 않습니다. – harrism

+0

컴파일에 실패한 파일과 컴파일 명령 줄에 포함 된 #include 목록을 제공 할 수 있습니까? – harrism

+1

@harrism - (+1) 당신은 완전히 옳습니다. 귀하의 의견을 적절한 대답을하고 나는 당신에게 고개를 줄게. – Zak

답변

1

네, 가능하지만 실제로는 매우 일반적입니다. 그러나 .hpp에 nvcc가 빌드 할 수없는 파일이 포함되어있는 경우 .cu에서 파일을 포함 할 수 없습니다.

해당 파일 주위에 #ifndef __CUDACC__을 사용하여 .cu와 nvcc를 컴파일 할 때 포함되지 않도록 할 수 있습니다.