제 클래스에서 나는 PlaySound(std::wstring)
이라는 함수를 선언했습니다. 이 클래스는 자체 네임 스페이스 내에 있습니다. 이 클래스의 인스턴스에서이 멤버 함수를 다른 곳에서 호출하려고하면 어떤 이유로 에 정의 된 PlaySoundW()
을 호출하려고 시도하는 것처럼 보이기 때문에 링커 오류가 발생합니다. 나는 내 자신의 네임 스페이스에있는 것들이 이러한 종류의 갈등을 막기위한 것이라고 생각했다.PlaySound()라는 멤버 함수는 호출시 링커 에러를 발생시킵니다.
링커 오류 :
Error 13 error LNK2019: unresolved external symbol "public: void __thiscall MyNamespace::SoundProcessor::PlaySoundW(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >)" ([email protected]@[email protected]@[email protected][email protected][email protected]@@[email protected][email protected]@@[email protected]@@Z) referenced in function "public: void __thiscall MyNamespace::Engine::Init(struct HWND__ *,long *,long *,int)" ([email protected]@[email protected]@[email protected]@[email protected])
나는이 이해할 수있는 가장 좋은, 내 SoundProcessor
에서 그것을 정의되지으니 그것이 내가 내 코드에 PlaySoundW()
를 사용하고 불평하는 것 같다,하지만 수업. 내 기능은 PlaySoundW()
이 아닙니다.
내가 (함수가 선언 된 것과 같은 네임 스페이스 내에서 AND에서) thusly 히 내 함수를 호출하고 있습니다 :
soundProcessor.PlaySound(TEXT("Sounds\\MySound.WAV"));
내가 바라고 이것이 내가보고 싶었어요 분명 뭔가있다.
아마 일종의'#DEFINE는 PlaySound PlaySoundW의 매크로가를 ...'. 그리고 전처리 기는 네임 스페이스를 신경 쓰지 않는다. – catscradle
네가 맞아,'MMSystem.h'에서'#define PlaySound PlaySoundW'라고 말합니다. 이것에 대해 제가 할 수있는 일이 있습니까? – Interminable
@Shaktal은 다음과 같이 할 수 있습니다. 내 함수의 이름을 바꿀뿐입니다. – catscradle