我在C++builder下建立了一个控制台工程,没有用vcl类,主要以前我一直在VC下写东西,程序只是建立了两个线程,提示连接错误,错误代码为:
[Linker Error] Unresolved external '__stdcall ThreadProc1(void *)' referenced from D:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\UNIT1.OBJ
[Linker Error] Unresolved external '__stdcall ThreadProc2(void *)' referenced from D:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\UNIT1.OBJ
求解。程序代码如下:
#include <windows.h>
#pragma hdrstop
DWORD WINAPI ThreadProc1( LPVOID lpParameter );
DWORD WINAPI ThreadProc2( LPVOID lpParameter );
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char* argv[])
{
DWORD dwThread1;
DWORD dwThread2;
//创建l线程1
::CreateThread(NULL,0,ThreadProc1,(LPVOID)0,1024,&dwSendThread);
//创建线程2
::CreateThread(NULL,0,ThreadProc2,(LPVOID)0,1024,&dwReceiveThread);
MSG msg;
bool flag;
//进行消息循环
while(1)
{
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
while( (flag = GetMessage( &msg, NULL, 0, 0 )) != 0)
{
if (flag == -1)
{
// handle the error and possibly exit
break;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
return 0;
}
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)