Hello, I am just starting to learn C++ and Decided to change from using Dev-C++ to Visual C++ 2008 express. but, there seems to be a problem.After compiling a few programs and showing off my new skills to my friend over MSN he tells me that he cant run my compiled exes! He gets the error message

"This application has failed to start because the applications configuration is incorrect. Reinstalling the program may fix the problem"

I was like "O.K, might be my code", I have just started learning about classes/interfaces ect so i decided to create a very simple program and compile it with VC++

#include <iostream>
using namespace std;

int main(void)
{
	cout<<"Does this work?";
	system("PAUSE"); //I know...bad me, i'm lazy
	return 0;
}

But no, he still gets that very same error message. So, I compiled the same code above in Dev-c++, not only did this increase the exes size by like 452KB, it also WORKED on his system.

My compiled exes with VC++ are about 8KB, I am not sure if I am compiling the correctly because this seems very small, compared to my 500kb exes from Dev C++.

The way I am compiling them is by clicking the green arrow (But, the mouse tip says its called "Start Debugging") I really dont think that the way im making my exes is actually the correct way, can anybody please help me and explian how to compile the code correctly with Visual C++ 08 express.

Sorry for the wall of text.

Recommended Answers

All 4 Replies

Your problem might be this:

Also, make sure you compile the program for Release and not for debug.

>>The way I am compiling them is by clicking the green arrow (But, the mouse tip says its called "Start Debugging"
No. To compile select menu Build --> Build Solution. Or hit <F7>

Also just under the File menu you see a row of buttons, and to the right of that rows you see a two combo boxs, If one of them says Debug then change it to Release

Alternatively, you should be able to statically link with the c-runtime library with the /MT switch but this is not recommended since any bugs in the crt will be hard-coded into your application. With the redistributables approach suggested by Ancient Dragon, the dll's on which your application is dependent can by updated. Static linkage will also increase the size of your programs.

Incidentally, to reduce the size of your dev-cpp application don't forget to strip the executable with the -s switch. Otherwise, the large size is due to static linkage with libstdc++; I think the bloat is largely due to the inclusion of <iostream>. If you want to dynamically link then stlport is good; it's additionally useful in that it provides considerably more wide character support than MinGW's libstdc++.

Thanks for your help. I haven't been able to get it to work so i'm just going to stick with Dev-c++, all this trouble just because I wanted an IDE with code wrap...

Thanks for your help. I haven't been able to get it to work so i'm just going to stick with Dev-c++, all this trouble just because I wanted an IDE with code wrap...

if you want just the code-wrap future you can use any good editor availible.... i.e. notepad++, textpad and many others.... i suggest to use gVIM availiable both in Windows and in Linux...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.