프로그램 probcons을 컴파일해야하지만 많은 오류가 있습니다. readme autor 쓰기 프로그램은 gcc 4.3과 호환되지만 4.7.2 만 있습니다. 이 오래된 프로그램을 컴파일 할 방법이 있습니까? 나는 많은 생물 정보학 서버가 그것을 사용하고 있기 때문에 프로그램에서 오류라고 생각하지 않는다.구식 gcc 용 프로그램 컴파일
나에게 가장 이상한이 오류입니다 : 클래스 SafeVector.h에서
Description Resource Path Location Type
expected ‘)’ before ‘size’ SafeVector.h /probcons line 27 C/C++ Problem
expected ‘)’ before ‘size’ SafeVector.h /probcons line 26 C/C++ Problem
: GCC의 이전 버전에서 필요하지 않은 가능성이 얼마나
/////////////////////////////////////////////////////////////////
// SafeVector.h
//
// STL vector with array bounds checking. To enable bounds
// checking, #define ENABLE_CHECKS.
/////////////////////////////////////////////////////////////////
#ifndef SAFEVECTOR_H
#define SAFEVECTOR_H
#include <cassert>
#include <vector>
/////////////////////////////////////////////////////////////////
// SafeVector
//
// Class derived from the STL std::vector for bounds checking.
/////////////////////////////////////////////////////////////////
template<class TYPE>
class SafeVector : public std::vector<TYPE>{
public:
// miscellaneous constructors
SafeVector() : std::vector<TYPE>() {}
/*ERROR HERE*/ SafeVector(size_t size) : std::vector<TYPE>(size) {}
/*ERROR HERE*/ SafeVector(size_t size, const TYPE &value) : std::vector<TYPE>(size, value) {}
SafeVector(const SafeVector &source) : std::vector<TYPE>(source) {}
#ifdef ENABLE_CHECKS
// [] array bounds checking
TYPE &operator[](int index){
assert (index >= 0 && index < (int) size());
return std::vector<TYPE>::operator[] ((size_t) index);
}
// [] const array bounds checking
const TYPE &operator[] (int index) const {
assert (index >= 0 && index < (int) size());
return std::vector<TYPE>::operator[] ((size_t) index) ;
}
#endif
};
포함 및 표준 : :접두사?
'std :: size_t'로 변경해보십시오. [size_t info] (http://en.cppreference.com/w/cpp/types/size_t) – crashmstr
보통 새 버전의 GCC로 이전 프로그램을 컴파일하는 데 문제가 없어야합니다 (다른 방법은 더 열심히). 오류에서 'size_t'을 알 수 없습니다. 새로운 버전의 경우에는'std :: size_t'이어야합니다. 당신은 그것을위한 typedef를 선언 할 수 있습니다. –
예, 모든 오류는 include 또는 (crashmstr wrote) std :: prefix가 누락 되었기 때문에 발생했습니다. 이전 버전에서는 std :: ??를 추가 할 필요가 없었습니다. gcc의 이전 버전에서 std ::없이 또는 어떻게 작동합니까? – Karlvonbahnhof