views:

241

answers:

1

I am using Microsoft Visual Studio 2008, and successfully building a command-line program in C++.

However, for my automated build I call cl.exe and link.exe outside the context of MSVC (I build using Maven Native, as most of the project is Java).

In that case, I manage to generate my executable. But when I execute it, I get the message "Program too big to fit in memory" right away.

There is no real problem of memory, of course: I have a powerful XP machine with 2 GB of memory. I guess that the executable lacks the correct binary headers, and that I need to use certain options to cl.exe or, more likely, to link.exe.

Any ideas?

+1  A: 

Inside the GUI, in project properties, you can see the command line options passed to cl.exe & link.exe by looking under "Command Line" in the C/C++ and Linker section respectively.

Have a look and compare and contrast to see what you're doing differently.

The error itself suggest your binary (.exe) is corrupt. See this for a bit more information.

KTC