我用vc的wizard做了一个win32 application程序,想用_beginthreadex()开始一个新线程。经查msdn得知需要#include"process.h",可即使这样做了,也还是不能用这个函数啊。错误提示信息为:_beginthreadex() undeclare,为什么呀?而同样是按这样的一个步骤,在一个基于mfc的程序中就可用_beginthreadex()这个函数,为什么呢?怎么解决?

解决方案 »

  1.   

    project  settings中把c/c++的code generation改为多线程即可
    另外如果是win32 application一般用CreateThread();函数来创建线程
      

  2.   

    不对呀,怎么弄?改成code generation也不行啊。
      

  3.   

    我觉得cy214说的不太对呀,因为我确实见过在win32 application中用beginthreadex()开始新线程的例子,但我的程序这样做的话,程序就提示"undeclare _beginthreadex()",这是为什么呢?
      

  4.   

    如果你是#include"process.h"那就不对,应是#include <process.h>
      

  5.   

    我一般用CreateThread 的
      
       如果象你这样弄,也可以
       在Project Settings下,选择「C/C++」,然後在Category下拉框中选择Code Generation。在Use Run-Time Library下拉框中,Single-Threaded改为Debug Multithreaded试试
    这是debug版本!这么改!
      

  6.   

    relese版本,同上,只是把Single-Threaded改为Multithreaded!
      

  7.   

    handsomerun(毛毛) 的方法可以,没有出现错误,可我还是有一个疑问,因为我有一个程序,它并没有在project settings下做如上的改动,但它用_beginthreadex却没任何问题,我看也半天也没看出来他是怎么弄的,能帮帮我看看吗?或者,如果不改动project settings,还有什么途径能在win32 application程序下使用_beginthreadex()?谢谢!!!