[問題] C++2010 error LNK2019: 無法解析的外

看板C_and_CPP作者時間14年前 (2011/09/23 08:10), 編輯推噓6(607)
留言13則, 10人參與, 最新討論串1/1
不好意思 小弟是 C++ 的菜鳥 小弟用的是Microsoft Visual C++ 2010 我照書上的步驟(C+2008入門進階): 新專案->win32主控台應用程式->-C++檔->程式碼: #include<iostream> using namespace std; int man(void) { cout << "HelloC++" <<endl; system("PAUSE"); return 0; } 結果確出現這錯誤: 錯誤 1 error LNK2019: 無法解析的外部符號 _main 在函式 ___tmainCRTStartup 中被參考 C:\Users\Chris\Documents\Visual Studio 2010\Projects\HelloC++\HelloC++\MSVCRTD.lib(crtexe.obj) 請問應該怎解決呢? 是書本上寫錯了嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.195.0.26

09/23 08:17, , 1F
新增專案->Visual C++->一般->空專案->輸入專案名
09/23 08:17, 1F

09/23 08:18, , 2F
->原始程式碼(右鍵)->新增項目->程式碼->hello.cpp
09/23 08:18, 2F
不好意思,照T大您的方法 確出現這樣的錯誤: 錯誤 1 error LNK1561: 必須定義進入點 c:\Users\Chris\documents\visual studio 2010\Projects\HelloC+\HelloC+\LINK ※ 編輯: chrishappy11 來自: 123.195.0.26 (09/23 08:24)

09/23 08:33, , 3F
真特別,2010 我 try 沒問題.
09/23 08:33, 3F

09/23 09:22, , 4F
你打錯字了啦
09/23 09:22, 4F

09/23 09:58, , 5F
man??
09/23 09:58, 5F

09/23 09:59, , 6F
不是 main嗎? XD
09/23 09:59, 6F

09/23 10:28, , 7F
應該是太man的問題
09/23 10:28, 7F

09/23 10:53, , 8F
真的很freshman.我就一直奇怪eric提到man幹麼
09/23 10:53, 8F

09/23 11:01, , 9F
原po加一行 int main{return man();} 就沒問題了!
09/23 11:01, 9F

09/23 11:02, , 10F
int main(){return man();} ...
09/23 11:02, 10F

09/23 11:44, , 11F
超man的
09/23 11:44, 11F

09/23 12:32, , 12F
好man
09/23 12:32, 12F

09/23 14:04, , 13F
man -> main
09/23 14:04, 13F
抱歉...打錯字了 應該是MAIN,感謝各位大大提醒 ※ 編輯: chrishappy11 來自: 123.195.0.26 (09/23 18:35)
文章代碼(AID): #1EUyvtxb (C_and_CPP)