2012-06-07 4 views
-2

여러 번 묻는 것을 알고 있지만이 문제를 이해할 수 없습니다. 이 내 헤더 파일 :악명 높은 'function'이이 범위에서 선언되지 않았습니다.

#include "Task.h" 


const int TASK_SIZE = 3; 

Task::Task() { 
} 

Task::~Task() { 
} 

Task::Task(double* _initialPoint, double* _finalPoint, int type) { 

    finalPosition = make_vector_from_pointer(TASK_SIZE,_finalPoint); 
    initialPosition = make_vector_from_pointer(TASK_SIZE, _initialPoint); 

} 

오류가 boost hpp file입니다 Task.h에 포함 된 storage_adaptors.hpp에 정의되어 make_vector_from_pointer 기능에서 발생

#ifndef TASK_H 
#define TASK_H 

#include "storage_adaptors.hpp" 
#include <boost/numeric/ublas/vector.hpp> 

class Task { 
private: 
    boost::numeric::ublas::vector<double> taskPosistionConstraint; 
    boost::numeric::ublas::vector<double> initialPosition; 
    boost::numeric::ublas::vector<double> finalPosition; 
    double pathLength; 
    int taskType; 

public: 
    Task(); 
    Task(double* _initialPoint, double* _finalPoint, int type); 
    double getLength(); 
    int getTaskType(); 

    ~Task(); 
}; 

#endif /* TASK_H */ 

은이는 CPP 파일입니다. 헤더 내가 범위 오류에서 데 왜 클래스 헤더 파일에 추가하면 :

가 부스트 기능이 있다면

Task.cpp:21: error: `make_vector_from_pointer' was not declared in this scope

+2

'boost :: numeric :: ubas :: make_vector_from_pointer' 또는'cpp'에서 네임 스페이스 boost :: numeric :: ublas를 사용합니다. – maverik

+0

누락 된 선언을 표시 할 수 있습니까? – juanchopanza

+0

또한 클래스 "작업"과 메서드 "작업"을 갖는 것은 – Filip

답변

3

, 그것은 boost::make_vector_from_pointer'는 안된다? 또는 부스트 네임 스페이스에 직접 있지 않은 경우 네임 스페이스가 무엇이든간에.

+0

그러나이 헤더 파일에는 네임 스페이스가 이미 추가되어 있습니다. 다시 나 혼자해야 할까? – Pouya

+0

@Pouya : 헤더 파일에'using namespace boost;'선언이 있습니까? 나는 그렇게 생각하지 않는다. 내가 옳다면 JohnB의 제안으로 문제가 해결 될 것입니다. – Gorpik

+0

헤더에 있지만 생성자 본문에 네임 스페이스를 추가하면 문제가 해결됩니다. 감사. – Pouya

관련 문제