-1
Error 1 error LNK2019: unresolved external symbol "public: void __thiscall Sounds::soundBox(void)" ([email protected]@@QAEXXZ) referenced in function _main
由於某種原因我得到這個錯誤,我真的不知道我做錯了什麼。 了wimm.lib添加playsound工作從主() 當我嘗試從類調用它playsound.cpp它調用錯誤...CPP錯誤LNK2019:無法解析的外部符號cpp
playsounds.h
#pragma once
#include <Windows.h>
class Sounds
{
public:
Sounds();
~Sounds();
void soundBox();
};
playsound.cpp調用時
#include "playsound.h"
Sounds::Sounds()
{
}
void soundBox()
{
PlaySound(TEXT("fx/boom1.wav"), NULL, SND_FILENAME);
}
Sounds::~Sounds()
{
}
的main.cpp
#include <iostream>
#include <conio.h>
#include "playsound.h"
int main()
{
Sounds newsound;
newsound.soundBox();
_getch();
}
在@πάνταῥεῖ發佈的鏈接中,請看[特意此處](http://stackoverflow.com/a/12574407/2296458) – CoryKramer 2015-02-05 18:12:04
奇怪的是,您已經正確地爲'聲音:: Sounds()'和'Sounds ::〜Sounds()',是由IDE生成的嗎? – 2015-02-05 18:14:59