C multi-threading

2007-03-13 6:49 am
我用visual c++ 6 寫個muti-threading既program, add左個ws2_32.lib之後compile少左好多error, 但係仲係有幾個冇solve到, 應該都係同multi-threading有關的, 係咪我應該仲有野要include呀?include係邊度呀?
更新1:

multi-threaded或multi-threaded debug的compiler option 在那裡加的?我應該沒有加這個 我本來有include winsock2.h的, 我再include埋windows.h之後都係唔得

更新2:

error: warning C4013: '_endthread' undefined; assuming extern returning int warning C4013: '_beginthread' undefined; assuming extern returning int error LNK2001: unresolved external symbol __endthread error LNK2001: unresolved external symbol __beginthread

更新3:

LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 Debug/test.exe : fatal error LNK1120: 3 unresolved externals Error executing link.exe. test.exe - 4 error(s), 2 warning(s)

更新4:

Since I am using Visual C++6 and so that the interface is differerent from Visual Studios, I can't find the path (project -> properties -> 'C/C++' -> pull-down to 'Code generation' -> 'Use Runtime library' )

更新5:

I got a main(void) function in me program, but actually I don't know what are the "main" method and "console", what it means?

回答 (3)

2007-03-13 7:54 pm
✔ 最佳答案
有沒有include winsock2.h 同 windows.h?
(應該include 這兩個就沒有問題)

是否使用一個object method 去做thread function ?
(object method 因為沒有pointer ,所以不能用作threading function)

還有,可否把error show 出來,沒有error,我們很難說是那兒出問題…

2007-03-14 18:08:41 補充:
Try change the setting: project -> properties -> 'C/C++' ->pull-down to 'Code generation' -> 'Use Runtime library' and set it to 'Multithreaded' or 'Multithreaded debug'

2007-03-14 18:09:09 補充:
Besides.....I wonder if you have put a "main" method into your program, or if you have declared your program as "console" one....Since the last one imply you don't have the "int main(void)" functionRef:http://www.thescripts.com/forum/thread263980.html
2007-03-16 10:29 pm
good!
2007-03-13 7:28 pm
未知閣下有否加上multi-threaded或multi-threaded debug的compiler option呢?


收錄日期: 2021-04-23 16:44:09
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070312000051KK05094

檢視 Wayback Machine 備份