クラス ファイルから関数を実行しようとしていますが、機能せず、次のエラー メッセージが表示されます: error LNK1120: 1 unresolved externals
エラー LNK2019: 未解決の外部シンボル "public: void __thiscall NS::Class1::test(void)" (?test@Class1@NS@@QAEXXZ) が関数 _main で参照されています
//Main.cpp
#include<iostream>
#include<string>
#include<Windows.h>
#include "Class1.h"
int main(){
NS::Class1 E;
E.test();
return 0;
};
//Class1.cpp
#include <Windows.h>
#include <string>
namespace NS{
class Class1{
Class1(){
OutputDebugString(L"Created.");
}
void test(){
OutputDebugString(L"Hello World");
}
};
}
//Class1.h
#ifndef _Class1_H_
#define _Class1_H_
namespace NS{
class Class1{
public:
void test();
};
}
#endif