• 12
• 15
• 19
• 27
• 9

# Help in getting Visual C++ 2005 running

This topic is 4433 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

HI, As this is the newbie section, I think this is appropriate. I just donwload MS Visual C++ 2005 an d am trying to get a simple program to run. I had MS VC__ 6.0 and the program runs complies and runs there. I suspect that I just don't know the buttons to push, and have not clure what it is telling me. I can't find the COmplie, BUild, Run buttons as in VC++ 6.0 I have tried the Build button, and then then Debug button. WHen I hit the Debug button, it says it can't find the exe. The program is // HelloWorld Program // // N. G. Cathey // January 1, 2006 #include <windows.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE HPrevInstance, LPSTR lpCmdLinde, int nShowCmd) { MessageBox (NULL, "All your bases now belong to us!", "Hello World", MB_OK | MB_ICONEXCLAMATION); return 0; } After hitting the BUild button (F7), I get ========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ========== After that when I hit the Debug button, that is when I get a message window that states "Unable to start .... Can't find program" Any help wioll be greatly appriciated. TIA Nathan

##### Share on other sites
Did you start a new project then goto the "Solution Explorer" on the left and right click the source file folder and either select new .cpp (C++) code file and enter your code or select existing item... if you alreadty wrote out your code.

Then goto to the menu bar at the top and hit build solution(F7) it should say 1 succeded, 0 failed etc...
then hit the debug button(f5) or start without debuging (CRtl-F5) to start it up.
That is what this sounds like to me a VS solution problem.

Also did you download the microsoft platform sdk?? The Express editon needs it to run win32 gui programs. (The full pay version of Visual studio has it included internally) You can download that for free on MS's Download page or just google for it. IT should work without that for console programs: (ie.. No windows specific stuff:) Example:

//code:
#include <iostream>
using namespace std;

int main() {
cout <<" Hey this is the console! I wish I were a window" << endl;
system("PAUSE");
}
//end code

I hope some of this helps, I am just going by what information you gave about your information and I never used VC++ 6.0, just Visual Studio 2003/VS C++ Express/And VS 2005 pro.

##### Share on other sites
You can also customize your toolbars to include buttons for building, compiling, debugging, etc... Other than that the solutions that World69Star suggested also do the dirty work for you. I personally prefer the buttons so that I don't have to remember a bunch of hotkeys to manipulate my IDE in addition to all the stuff I'm already trying to remember as a result of studying C++.

Vopisk

##### Share on other sites
Thanks for the imformation. THe inital problem was the the cpp file I created was not in the Source folder. I have no clue as to where it was crated, but that was the problem.
I now have a noter prolem. When I go to build I get the following error message assocate with the last line of the code listed below.

MessageBox (NULL, "All your bases now belong to us!",
"Hello World", MB_OK | MB_ICONEXCLAMATION);

Error 1 error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [33]' to 'LPCWSTR' h:\c++\visual studio 2005\projects\hello_world_1\hello_world_1\helloworld_1.cpp 15

I think this is teling that there is a problem with "Hello World" and perhaps the data type, but .... .... HELP

TIA
Nathan

##### Share on other sites
Per default the solutions of VC 2005 are set to Unicode. You can change the setting in the project configuration back to single byte or convert the code to Unicode.

In your case you'd need to add the _T macro in front of text literals. This tells the compiler to change the text string to unicode or let them be as single byte according to your project settings.

MessageBox( NULL, _T( "All your bases now belong to us!" ), _T( "Hello World" ), MB_OK | MB_ICONEXCLAMATION );

You may have to include <tchar.h> to get the macro definition.

##### Share on other sites
Quote:
 Original post by EndurionPer default the solutions of VC 2005 are set to Unicode. You can change the setting in the project configuration back to single byte or convert the code to Unicode.In your case you'd need to add the _T macro in front of text literals. This tells the compiler to change the text string to unicode or let them be as single byte according to your project settings.MessageBox( NULL, _T( "All your bases now belong to us!" ), _T( "Hello World" ), MB_OK | MB_ICONEXCLAMATION );You may have to include to get the macro definition.

That was it!! Thanks! THe boks I have on C++ are a couple of years old and I don't rmember them talking about Unicode. Is that new? Is it the new standard, or just something I need to confiure VC++2005 for?

Thanks again!
Nathan

##### Share on other sites
Unicode is not exactly new. Simply put it's a standard that allows for more unique characters. If you ever thought of localizing in different parts of the world you stumble upon lots and lots and heaps and lots of different letters. A char (usually a byte) is not even close to enough space for a letter that way.

Unicode is a standard that tries to define a single set of letters to be used.

NT, 2000 and XP are built on Unicode per default, 95/98/ME are single byte but can have a "Unicode layer" installed. As of Visual Studio 2002/3 you were only able to install them on Win 2000 and newer. Defaulting the projects to Unicode is just the next logical step.
Unicode will be faster on NT/2000/XP anyway, if you had single byte Window would have to "translate" any strings to Unicode before using them. OTOH Unicode might pose a problem if you plan to deliver for 95/98/ME as well.

##### Share on other sites
Quote:
 Original post by EndurionUnicode is not exactly new. ....Unicode is a standard that tries to define a single set of letters to be used.NT, 2000 and XP are built on Unicode per default, 95/98/ME are single byte but can have a "Unicode layer" installed. As of Visual Studio 2002/3 you were only able to install them on Win 2000 and newer. Defaulting the projects to Unicode is just the next logical step. Unicode will be faster on NT/2000/XP anyway, if you had single byte Window would have to "translate" any strings to Unicode before using them. OTOH Unicode might pose a problem if you plan to deliver for 95/98/ME as well.

Endurion - Thanks again for the response. Sounds as if I need to learn how to programe with Unicode as the default, and how to work around it since several of my C++ books seem to ignore this feature/fact. One of these is a new relase, a book called Beginning Game Programing" by Jonathan S. Harbour. He appears to have written it for MS VC++ 6.0 and DX9. From the earlier parts of this thread, I understand that MS VC++ 6 and DX9 SDK do not work together. This makes it VERY frustrating to a newbie like me that runs into problem after problem.

Thanks again for all the help, and taking the time to provide a detailed response.

Nathan