2013-07-12 105 views
0

我正在編寫一個程序,顯示矩形和三角形的形狀,並計算這些形狀的面積。我使用的是Microsoft Visual Studio。這是我的代碼:C Plus Plus:計算矩形和三角形的面積

我有四個代碼和錯誤列表中的圖像:Shapes.h,shapesfunchtions3.h,shapes3.cpp和testshapes3.cpp

Mediafire Folder of my four codes

,但我得到這個錯誤:任何解決方案?

,如果你不能看到錯誤列表的形象,那麼它是這樣的:

錯誤1

錯誤LNK2019:無法解析的外部符號「市民:無效__thiscall形狀:: DisplayMenu(無效) 「(?DisplayMenu @ Shapes @@ QAEXXZ)在函數」public:char __thiscall Shapes :: SelectShape(void)「(?SelectShape @ Shapes @@ QAEDXZ)中引用C:\ Users \ Eduardo \ Documents \ Mission College \ Projects \ shapes3 \ shapes3 \ shapes3.obj

錯誤2

e rror LNK2019:在函數「public:char __thiscall Shapes :: SelectShape(void)」中引用的未解析外部符號「public:void __thiscall Shapes :: GetSelection(void)」(?GetSelection @ Shapes @@ QAEXXZ)(?SelectShape @ Shapes @ @QAEDXZ)C:\用戶\愛德華\文件\團學院\項目\ shapes3 \ shapes3 \ shapes3.obj

錯誤3

錯誤LNK2019:解析外部符號「公共:無效__thiscall形狀:: CheckSelection(在函數「public:char __thiscall Shapes :: SelectShape(void)」(?SelectShape @ Shapes @@ QAEDXZ)中引用的「(」CheckSelection @ Shapes @@ QAEXXZ)C:\ Users \ Eduardo \ Documents \ Mission College \ Projects \ shapes3 \ shapes3 \ shapes3.obj

E RROR 4

錯誤LNK1120:3周無法解析的外部C:\用戶\愛德華\文檔\ Mission College學院\工程\ shapes3 \調試\ shapes3.exe

+0

[見這個問題。](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-以及如何做我修復) – chris

回答

0

你實現了這個功能:(您需要更改這個:)

void DisplayMenu() 
{ 
    // ... 
} 

但它不同於:(這個:)

void Shapes::DisplayMenu() 
{ 
    // ... 
} 

所以做到這一點:

void GetSelection() 

和此:

void CheckSelection() 
+0

我只是想出來並修復我的錯誤。我忘記把void Shapes ::用於DisplayMenu(),GetSelection(),CheckSelection()。 – Loceddy