2011-09-12 9 views
1

으로 VisualStudio하지 나는 다음과 같은 코드로, 내 문제의 미니멀 예를 복제 시도 (초기화의 순서에 대한)하지만, 다음과 같은 오류를 제공, Cygwin에서에 ++ g에 실패하고 난 그냥 아무 단서 이유 :컴파일 ++ g에 오류 및

Interpolator2.cpp:39: error: expected ‘,’ or ‘...’ before numeric constant 
Interpolator2.cpp: In constructor ‘Interpolator<DIM, SAMPLESTYPE>::Interpolator(const std::vector<Vector<DIM, SAMPLESTYPE>, std::allocator<Vector<DIM, SAMPLESTYPE> > >&, const std::vector<double, std::allocator<double> >&, const std::vector<Vector<DIM, SAMPLESTYPE>, std::allocator<Vector<DIM, SAMPLESTYPE> > >&)’: 
Interpolator2.cpp:45: error: ‘_wB’ was not declared in this scope 
Interpolator2.cpp:46: error: ‘_sqrDist’ was not declared in this scope 
Interpolator2.cpp:47: error: ‘_kernel’ was not declared in this scope 
Interpolator2.cpp:48: error: ‘_interpolateBins’ was not declared in this scope 
Interpolator2.cpp:49: error: ‘_kNNDist’ was not declared in this scope 
Interpolator2.cpp:50: error: ‘_NLevels’ was not declared in this scope 
Interpolator2.cpp: At global scope: 
Interpolator2.cpp:131: error: expected ‘,’ or ‘...’ before numeric constant 
Interpolator2.cpp: In constructor ‘InterpModeData<DIM, SAMPLESTYPE>::InterpModeData(int, double, const std::vector<std::vector<TsFlow, std::allocator<TsFlow> >, std::allocator<std::vector<TsFlow, std::allocator<TsFlow> > > >&, Vector<DIM, SAMPLESTYPE> (*)(const Vector<DIM, SAMPLESTYPE>&, const Vector<DIM, SAMPLESTYPE>&, double), std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >&, double (*)(const Vector<DIM, SAMPLESTYPE>&, const Vector<DIM, SAMPLESTYPE>&, double), const std::vector<double, std::allocator<double> >&, const std::vector<double, std::allocator<double> >&, const std::vector<Vector<DIM, SAMPLESTYPE>, std::allocator<Vector<DIM, SAMPLESTYPE> > >&, const std::vector<Vector<DIM, SAMPLESTYPE>, std::allocator<Vector<DIM, SAMPLESTYPE> > >&)’: 
Interpolator2.cpp:135: error: ‘_sumWA’ was not declared in this scope 
Interpolator2.cpp:135: error: ‘_sumWB’ was not declared in this scope 
Interpolator2.cpp:135: error: ‘_samples’ was not declared in this scope 
Interpolator2.cpp: In function ‘int main()’: 
Interpolator2.cpp:206: error: no matching function for call to ‘Interpolator<2, double>::Interpolator(std::vector<Vector<2, double>, std::allocator<Vector<2, double> > >&, std::vector<double, std::allocator<double> >&, std::vector<Vector<2, double>, std::allocator<Vector<2, double> > >&, std::vector<double, std::allocator<double> >&, <unresolved overloaded function type>, <unresolved overloaded function type>, <unresolved overloaded function type>, int, int)’ 
Interpolator2.cpp:43: note: candidates are: Interpolator<DIM, SAMPLESTYPE>::Interpolator(const std::vector<Vector<DIM, SAMPLESTYPE>, std::allocator<Vector<DIM, SAMPLESTYPE> > >&, const std::vector<double, std::allocator<double> >&, const std::vector<Vector<DIM, SAMPLESTYPE>, std::allocator<Vector<DIM, SAMPLESTYPE> > >&) [with int DIM = 2, SAMPLESTYPE = double] 
Interpolator2.cpp:36: note:     Interpolator<2, double>::Interpolator(const Interpolator<2, double>&) 
Interpolator2.cpp: In member function ‘void Interpolator<DIM, SAMPLESTYPE>::interpolate(double, const std::vector<Vector<DIM, SAMPLESTYPE>, std::allocator<Vector<DIM, SAMPLESTYPE> > >&, std::vector<double, std::allocator<double> >&) [with int DIM = 2, SAMPLESTYPE = double]’: 
Interpolator2.cpp:212: instantiated from here 
Interpolator2.cpp:58: error: no matching function for call to ‘InterpModeData<2, double>::InterpModeData(unsigned int&, double&, std::vector<std::vector<TsFlow, std::allocator<TsFlow> >, std::allocator<std::vector<TsFlow, std::allocator<TsFlow> > > >&, Vector<2, double> (*&)(const Vector<2, double>&, const Vector<2, double>&, double), std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >&, double (*&)(const Vector<2, double>&, const Vector<2, double>&, double), std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, std::vector<Vector<2, double>, std::allocator<Vector<2, double> > >&, std::vector<Vector<2, double>, std::allocator<Vector<2, double> > >&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, const std::vector<Vector<2, double>, std::allocator<Vector<2, double> > >&)’ 
Interpolator2.cpp:133: note: candidates are: InterpModeData<DIM, SAMPLESTYPE>::InterpModeData(int, double, const std::vector<std::vector<TsFlow, std::allocator<TsFlow> >, std::allocator<std::vector<TsFlow, std::allocator<TsFlow> > > >&, Vector<DIM, SAMPLESTYPE> (*)(const Vector<DIM, SAMPLESTYPE>&, const Vector<DIM, SAMPLESTYPE>&, double), std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >&, double (*)(const Vector<DIM, SAMPLESTYPE>&, const Vector<DIM, SAMPLESTYPE>&, double), const std::vector<double, std::allocator<double> >&, const std::vector<double, std::allocator<double> >&, const std::vector<Vector<DIM, SAMPLESTYPE>, std::allocator<Vector<DIM, SAMPLESTYPE> > >&, const std::vector<Vector<DIM, SAMPLESTYPE>, std::allocator<Vector<DIM, SAMPLESTYPE> > >&) [with int DIM = 2, SAMPLESTYPE = double] 
Interpolator2.cpp:127: note:     InterpModeData<2, double>::InterpModeData(const InterpModeData<2, double>&) 

어떤 생각? 감사합니다.

+1

많은 인수를 가진 생성자 함수가있는 경우 리팩토링을 고려해야합니다. 또한'typedef'를 사용하십시오! 코드를 읽기가 훨씬 쉬울 것입니다. –

+0

다른 사이트로 연결하지 말고 실제 질문에서 문제를 나타내는 최소 코드 예제를 게시하십시오. –

+0

오류가 215 줄 파일의 39 줄에 있습니다 ... 최소한의 예제는 아닙니다 :-) 그 줄 다음에 많은 코드를 잘라내어 동일한 오류 메시지가 계속 표시되는지 확인하십시오. – user9876

답변

4

밑줄로 시작하는 식별자 다음에 대문자를 사용하는 것은 불법입니다 (예 : _B on line 39.

컴파일러는 정수를 의미하는 #define d 일 가능성이 있으며 오류를 설명합니다. 올바른 ID로 변경하십시오.

+0

대단히 감사합니다! 나는 그것을 알지 못했고 이제는 잘 컴파일됩니다. – WhitAngl

+2

@WhitAngl : 식별자에서 이중 언더 스코어를 사용하는 것도 불법입니다. 여기에 그 일을하지는 않았지만 알기에 좋은 점은 :-) –

+2

@Peter : 또한 식별자가 전역 네임 스페이스에서 사용되는 경우 하나의 밑줄 문자와 소문자로 시작하는 식별자의 이름을 지정하는 것도 불법입니다. 이것은 세 가지 제한 사항을 완료합니다 :) –