[問題] unidentified reference to ...
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Dev C++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
<iostream>
還有自訂的 "GradeBook.h"
問題(Question):
現在在自習 C++ How To Progarm (Paul Deitel, Harvey Deitel)
這本書的第3.8節
把自己寫的 class 拆成 interface 和 implementation 兩部分
完全照著課本打
建立了 GradeBook.h GradeBook.cpp 和 test.cpp 三個檔案
不過在執行時都出現了以下3個錯誤訊息
[Linker error] unidentified reference to 'WinMain@16'
Id returned 1 exit status
[Build Error] [GradeBook.exe] Error 1
是我開啟的檔案類型有誤嗎?還是需要做甚麼設定才能讓他們一起執行呢?
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
GradeBook.h http://codepad.org/GfKWIgyi
GradeBook.cpp http://codepad.org/KcuVf4lP
test.cpp http://codepad.org/8teJyKSp
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.252.56
※ 編輯: kennyli 來自: 140.112.4.183 (02/03 12:21)
※ 編輯: kennyli 來自: 140.112.4.183 (02/03 12:22)
→
02/03 12:27, , 1F
02/03 12:27, 1F
→
02/03 12:29, , 2F
02/03 12:29, 2F
→
02/03 12:30, , 3F
02/03 12:30, 3F
解決了
1. 打開 Dev C++ 開啟 Project 選擇 Console Application
2. 將要一起執行的 .cpp檔加入專案(包括定義 member function 的 .cpp檔也要)
3. 執行含有 main 的檔案就OK了
資料來源:http://www.cplusplus.com/forum/beginner/25188/
※ 編輯: kennyli 來自: 140.112.252.56 (02/03 14:55)
→
02/03 14:59, , 4F
02/03 14:59, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章