I am using CreateProcess to invoke cl
to compile and link another C++ program ( TestProg.cxx
) into a DLL. I invoke cl
with the following compilation options:
/Od /nologo /Fo /RTC /w /Zc /EHsc /I\INCLUDE /I\LIB /I\PATH TestProg.cxx /DLL
the call:
if ( CreateProcess(full path to cl.exe, compilation options, NULL,NULL,FALSE,0, NULL,NULL,&si,&pi) )
{
//....
}
Running the application from VS tools prompt, I got the following linkage error:
LINK : fatal error LNK1561: entry point must be defined
What am I doing wrong? I searched the answer for the last 1/2 day at the web, but didn't find it. Using windows API is new to me.
Thanks
That's not an error in using CreateProcess()
to run the compiler, it's an error from the compiler telling you that your TestProg.cxx
has no main()
function. (Or DllMain()
, since you seem to be building a DLL.)
You have a linker error, so linker was unable to build you a binary. The entry point can be provided via /ENTRY
command line parameter, see MSDN for details:
You will have something like: cl.exe /ENTRY:DllMain ...
where DllMain will be your entry point function in source code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.