Linker error using system(*.*)
OS: Win2k
Compiler: Borland Turbo C++ v 4.52
Code:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
printf("About to spawn command.com and run a DOS command\n");
system("dir");
return 0;
}
Issue:
The above code compiles just fine. When I rebuild (which includes linking) I get the following error message:
Compiling TEST1.CPP:
Linking test1.exe:
Linker Warning: No module definition file specified: using defaults
Linker Error: Undefined symbol _system in module TEST1.CPP.
(Throws the same linker error for all of the "execl" series commands as well.)
I've changed the system command to system() and rebuilt. The error changes to a compile error "too few parameters in call to system(const *char)... like we would normally expect.
I have a feeling I'm missing something really simple here but, not having seen this before, I am at a loss.
Any kick in the right direction would be greatly appreciated.
Many thanks!
Dan
Different Compiler Worked
Many Thanks, Salem: The third compiler worked!
For anyone interested: The compiler that ended up doing the job was the Bloodshed Dev-C++. A freebie that, at least initially, looks as capable as anything I've been exposed to thus far.
Dave_Sinkula: direct hit!
Changed target type to Application, Win32, Console and rebuild the source file.
EUREKA! A perfect compile and link.
I'd like to take this opportunity to thank everyone who took the time to change into boots and give me a good kick. My rear-end is pretty sore now. I'm taking my ball and going home.......