大家好
小弟有一個範例程式一直跑不起來 希望大家能協助
我做的事很簡單 就像下面描述的一樣簡單:
VS2010 新增一個名為 TEST 的 Win32 Console Application 專案
然後在這個專案裡面額外新增一個名為 CWin 的 Class Libraty 計畫
編譯器沒有做其他任何額外的設定
貼上所有程式碼:
// CWin.h
#pragma once
class CWin
{
public:
void nothing();
};
// CWin.cpp
#include "stdafx.h"
#include "CWin.h"
void CWin::nothing()
{
};
// TEST.cpp
#include "stdafx.h"
#include "../CWin/CWin.h"
int main()
{
CWin win1;
win1.nothing();
return 0;
}
出現錯誤訊息是:
Error 1 error LNK2019: unresolved external symbol "public: void __thiscall
CWin::nothing(void)" ([email protected]@@QAEXXZ) referenced in function
_main c:\...\TEST.obj
Error 2 error LNK1120: 1 unresolved externals c:\...\TEST.exe 1