我正在使用CreateProcess调用cl来编译并将另一个C ++程序(TestProg.cxx)链接到DLL中。我使用以下编译选项调用cl

/Od /nologo /Fo /RTC /w /Zc /EHsc /I\INCLUDE /I\LIB /I\PATH TestProg.cxx /DLL


电话:

if ( CreateProcess(full path to cl.exe, compilation options, NULL,NULL,FALSE,0,       NULL,NULL,&si,&pi) )
{
 //....
}


从VS工具提示运行应用程序,出现以下链接错误:

LINK : fatal error LNK1561: entry point must be defined


我究竟做错了什么?
我在网上搜索了过去1/2天的答案,但没有找到答案。使用Windows API对我来说是新手。

谢谢

最佳答案

这不是使用CreateProcess()运行编译器的错误,而是来自编译器的一个错误,告诉您TestProg.cxx没有main()函数。 (或DllMain(),因为您似乎正在构建DLL。)

关于c++ - 如何设置从CreateProcess创建的流程的入口点,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9719664/

10-13 05:56