inline 때문에 생긴 error LNK2005


Linking...
testgameapplication.obj : error LNK2005: "public: struct _D3DPRESENT_PARAMETERS_ const * __thiscall Graphics::Display::GetPresentParameters(void)const " (?GetPresentParameters@Display@Graphics@@QBEPBU_D3DPRESENT_PARAMETERS_@@XZ)이(가) testgame.obj에 이미 정의되어 있습니다.
application_win32.debug.lib(gameapplication.obj) : error LNK2005: "public: struct _D3DPRESENT_PARAMETERS_ const * __thiscall Graphics::Display::GetPresentParameters(void)const " (?GetPresentParameters@Display@Graphics@@QBEPBU_D3DPRESENT_PARAMETERS_@@XZ)이(가) testgame.obj에 이미 정의되어 있습니다.
...
..\..\bin\win32\testgame.debug.exe : fatal error LNK1169: 여러 번 정의된 기호가 있습니다.

Error executing link.exe (tool returned code: 1169)

testgame - 24 error(s), 0 warning(s)

작업 중 링크에러가 총 에러 24개가 나오는 것이 아닌가요. 보통 error LNK2005 에러는 제목 그대로 에러 나온놈이 어딘간에 중복 정의가 되었을 때 나오는 에러죠. 그래서 헤더파일 제일 윗 부분을 일단 보니 #pragma once가 잘 있으니까 이건 아닐꺼고 이게 문제였다면 이 파일이 전부터 에러가 났어야 하는데 이번에 함수 4개 추가하면서 나온 에러라 이건 아닐 것이다 하고 자세히 보니...

const D3DPRESENT_PARAMETERS*
Display::GetPresentParameters() const
{
return this->presentParams;
}

헤더파일에 이런식으로 되있더군요. 다른 함수들과의 차이점은 inline를 빼먹었다는 것. inline를 넣어주니 잘 돌아가 주십니다. inline이라 함은 함수가 호출되어지는 부분에 함수 덩어리 소스 내용이 틀어박혀지고 등등 하는건데 이게 링크에러까지 내줄주는 예상 밖이네요. 역시 아직 전 기초가 부족한 영원한 초짜일 뿐이고~

댓글

이 블로그의 인기 게시물

'xxx.exe' 프로그램을 시작할 수 없습니다. 지정된 파일을 찾을 수 없습니다.

goorm IDE에서 node.js 프로젝트로 Hello World Simple Server 만들어 띄워보기

애드센스 수익을 웨스턴 유니온으로 수표대신 현금으로 지급 받아보자.