[問題] error LNK2019 與 fatal error LNK1120
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC++ 2010
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
iostream
問題(Question):
我是個程式新手,最近借了一本關於VC++ 2008的參考書,打算試著自學C++
結果才第一次打範例進空白專案裡,執行時卻失敗
會先跳出一個視窗,說專案組態已過期,問是否要建置,這裡我選是
之後又跳建置錯誤,問是否要繼續並且執行上次成功的組建
我也選是,但我沒有上次的組建,因此理所當然的無法啟動程式和系統找不到指定的路徑
跟版上http://www.ptt.cc/bbs/C_and_CPP/M.1276188003.A.BA4.html
這篇文章的現象很類似,但他是因為程式碼錯誤而失敗
至少我看我自己的程式碼(因為是範例,非常簡單)沒有找到錯誤......
底下附上錯誤訊息及程式碼
餵入的資料(Input):
無
預期的正確結果(Expected Output):
This is a simple program that outputs some text.
You can output more lines of text.
just by repeating the output statement like this.
Press any key to continue . . .
錯誤結果(Wrong Output):
錯誤訊息:
1>------ 已開始建置: 專案: test2, 組態: Debug Win32 ------
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: 無法解析的外部符號 _WinMain@16 在
函式 ___tmainCRTStartup 中被參考
1>C:\Users\o07608\Desktop\Visual C++ project\test2\Debug\test2.exe :
fatal error LNK1120: 1 個無法解析的外部符號
========== 建置: 0 成功、1 失敗、0 最新、0 略過 ==========
程式碼(Code):(請善用置底文網頁, 記得排版)
#include <iostream>
int main()
{
std::cout << "This is a simple program that outputs some text." << std::endl;
std::cout << "You can output more lines of text." << std::endl;
std::cout << "just by repeating the output statement like this." <<std::endl;
return 0;
}
補充說明(Supplement):
我自己有先google過 error LNK2019 和 fatal error LNK1120 的解決辦法
但似乎不同的情況下,解決辦法也會有差異,而這差異已經超出我的能力範圍
希望板友能不吝替我解惑
在此先感謝大家了 m(_ _)m
--
TWO DONE, FOUR TO GO
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.27.20.78
→
01/08 16:54, , 1F
01/08 16:54, 1F
→
01/08 16:56, , 2F
01/08 16:56, 2F
→
01/08 16:56, , 3F
01/08 16:56, 3F
→
01/08 16:56, , 4F
01/08 16:56, 4F
→
01/08 16:57, , 5F
01/08 16:57, 5F
→
01/08 16:57, , 6F
01/08 16:57, 6F
成功了!
請問為什麼會有這種差異呢?
→
01/08 17:48, , 7F
01/08 17:48, 7F
→
01/08 17:48, , 8F
01/08 17:48, 8F
→
01/08 17:49, , 9F
01/08 17:49, 9F
→
01/08 17:50, , 10F
01/08 17:50, 10F
→
01/08 17:50, , 11F
01/08 17:50, 11F
→
01/08 17:52, , 12F
01/08 17:52, 12F
→
01/08 19:48, , 13F
01/08 19:48, 13F
推
01/08 21:57, , 14F
01/08 21:57, 14F
O_oa
※ 編輯: o07608 來自: 114.27.20.78 (01/08 23:49)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章