关于process.h与—beginthreadex

来源:百度知道 编辑:UC知道 时间:2024/05/12 07:04:50
刚接触动态连接库,按照书上的例子做,但是怎么对照都发生错误。编译之后说:
--------------------Configuration: testdlib - Win32 Debug--------------------
Compiling...
testdlib.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\dlib\testdlib\testdlib.cpp(25) : error C2065: '_beginthreadex' : undeclared identifier
执行 cl.exe 时出错.

testdlib.exe - 1 error(s), 0 warning(s)

即-beginthreadex,没有声明,但是我在cpp中明明已经加了头文件#include <process.h>,我也查看了process.h,确实有-beginthreadex这个函数,然后我把#include <process.h>改成#include “process.h”,#include <process>,#include “process”,编译之后都不行。
下面我把代码发这里,希望高手帮帮我。。。我完全没辙了

#include "stdafx.h"
#include <windows.h>
#include <iostream>
#include <process.h>
using namespace std;

#include"../dlib.h"
#pragma comment(lib,"..\\debug\\dlib.lib")

unsigned _stdcall s(LPVOID s)
{

同学 你用的是哪本书 能告诉我吗 ?
按照这个设置就不会有问题:
project setting -> c/c++ -> Code Generator -> use run-time library -> Mulitthreaded DLL
^^^^^^^^^^^^^^
因为默认的是单线程 单线程那你肯定创不了线程的 !

瑞气朝浮 浮五云阁

蓝兰岛漂流记