2014-03-01 2 views
0
내 VS2012 프로젝트를 컴파일 할 때 다음과 같은 오류를 얻을

:LNK 2,019되지 않은 외부 기호 오류

오류 LNK2019을 : 확인되지 않은 외부 기호 "공공 : INT는지도 __thiscall :: GetBlockRef (지능, int)를"(? GetBlockRef @ 함수에서 참조지도 @@ QAEHHH @의 Z) "공개 : 무효 __thiscall지도 :: LoadLevel (INT)"(LoadLevel지도 @@ QAEXH의 @의 Z)

오류 LNK1120 @ : 1 개 확인되지 않은 외부

비슷한 문제가있는 사이트를 여러 개 확인했지만 찾을 수 없습니다. 문제는 에 대한 호출이다. map :: GetBlockRef (int, int)에 넣는다. void map :: LoadLevel (int).

GetBlockRef()를 호출 할 수없는 이유는 무엇입니까?

map.h

#include "Map.h" 

map::map() 
{ 
    for(int i = 0; i < 196; i++) 
    { 
     blockRef.push_back(-1); 
    } 
} 

int GetGridCoord(int v) 
{ 
    return (v/48) - 1; 
} 

int GetBlockRef(int x, int y) //Defined correctly 
{ 
    x = GetGridCoord(x); 
    y = GetGridCoord(y); 

    int index = x + (14 * y); 

    return index; 
} 

void map::LoadLevel(int level) 
{ 
    int index; 
    block tmpBlock; 

    tmpBlock.InitBlockData(144, 144, "rock"); 
    index = GetBlockRef(tmpBlock.xPos, tmpBlock.yPos); //THIS IS CAUSING ERRORS!! 
    blockRef[index] = 0; 
    blocks.push_back(tmpBlock); 
} 

답변

5

//Defined correctly 정말

#ifndef MAP_H 
#define MAP_H 

#include <windows.h> 
#include <vector> 
#include "Block.h" 

using namespace std; 

class map 
{ 
    public: 
     map(); 
     int GetGridCoord(int); 
     int GetBlockRef(int, int); //Declared correctly 
     void LoadLevel(int); 

     vector<block>blocks; 
     vector<int>blockRef; 
}; 

#endif 

map.cpp.

int GetBlockRef(int x, int y)int map::GetBlockRef(int x, int y)과 같지 않습니다.

+0

오 와우 ... 함수가 x.x에 속하는 클래스를 지정하는 것을 완전히 잊었습니다. 감사합니다! –

관련 문제