这是我第一次,我想使用windows进行并行处理 CreateProcess 函数。根据MSDN上的示例,我创建了一个 LPTSTR (non-const)TCHAR string command line argument like this
This is my first time and I'd like to make a parallel process using the windows CreateProcess function. Based on the example at MSDN I created a LPTSTR "(non-const) TCHAR string" command line argument like this
LPTSTR szCmdline[] = _tcsdup(TEXT("\C:\\MyProgram_linux_1.1\\MyProgram.exe") );LPTSTR等此处讨论字符和字符串类型
命令行参数传递给 CreateProcess 像这样
The command line argument is passed to CreateProcess like this
if (!CreateProcess(NULL, szCmdline, /*...*/) ) cout << "ERROR: cannot start CreateProcess" << endl;这些标题存在
#include <stdio.h> #include <stdlib.h> #include <windows.h> #include <strsafe.h> #include <direct.h>编译时出现错误:
error C3861: '_tcsdup': identifier not found搜索相同的错误错误,但解决方案是特定于使用.NET框架,而不是解释错误C3861:'_tcsdup'
不确定是否相关,但在 if(!CreateProcess(NULL))上还有错误C2059:语法错误:')' ,szCmdline,/*...*/))cout < ERROR:can not start CreateProcess<< endl;
Not sure if it related but there is also an error C2059: syntax error : ')' on the if (!CreateProcess(NULL, szCmdline, /*...*/) ) cout << "ERROR: cannot start CreateProcess" << endl;
此错误如何修复?
此外,我使用的是 fork()的学习步骤 c $ c> 函数 - Visual Studio接口更容易使用,一旦这被调试和工作,我将更改到g ++界面,并更改为 fork()并从那里调试 - 所以一个解决方案,导致 fork(),如果可能,是最有益的。
Also, I am using the CreateProcess as a learning step towards learning the Linux fork() function - the Visual Studio interface is easier for me to use and once this is debugged and works, I will change to the g++ interface and change to fork() and debug from there - so a solution that leads to fork(), if possible, is the most beneficial.
推荐答案添加以下内容:
#include <tchar.h>更多推荐
错误C3861:'
发布评论