C++ just beginning?????

Pages: 12
I am using Visual C++ 2008 express edition. When I make a new program, I go to win32 and click new console application, but when I put this in:

#include <iostream>//

int main()
{
std::cout <<"Welcome to C++\n";

return 0;

}

And then I press the little play button, it says that it is out of date and asks me if I want to build it. If I say yes, it says it encountered build errors and asks me if I would like to run it from last succesful build. If I press no, nothing happens, but if I press yes it goes to an error message that says that the system could not find the file specified. If I press no when it asks if I want to build it, it goes straight to this message. Please help.
It compile normal for me...
Can you place your errors here?
what do you mean?
Oh, I remembered, sorry.
Don't use Win32Console Application.
Use Empty Project when you create a new project. And then from the solution explorer add a new .cpp file and write your code there.
If you change what already exists from the Win32Console Application (the one that opens when you create the project) then it doesn't compile... (At least i don't know how to make it compile...)
So it is better if you just want to do some experiments and learn, to use the Empty Project...
Last edited on
If I use an Empty Project and add a new .cpp file and write that same code, it still does the build error thing.
Can you post here your build error log?
It is the output window that appears at the bottom when you compile the file.
1>------ Build started: Project: Hello World, Configuration: Debug Win32 ------
1>Embedding manifest...
1>mt.exe : general error c10100b1: Failed to load file "..\Debug\Hello World.exe". The system cannot find the path specified.
1>Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\Hello World\Hello World\Debug\BuildLog.htm"
1>Hello World - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


That's all it said
you shall try the Batch build in the build menu
tried it, didn't work just said that there were 2 failed instead of one.
Try first to use Build Solution (F7).
Go to your project folder and find out if the file that it is trying to find does exist (it is the executable file).
i don't think it does exist because I checked the file it was referring to, and there was no .exe file in the debug folder.
Press Alt+F7 to open the project properties. Click on the Configuration Properties from the list at the left and then from the top right side the Configuration Manager. And check to be in Debug and the build checkbox on.
by configuration the drop box is gray and just says n/a in it, and the configuration manager button is gray too, and unclickable.
Thats why you hve to click fro the left list the Configuration Properties, so they will be enabled. If you have selected Common Properties, they are Gray...
I use Visual Studio 2008 Professional, and under the Build menu there is an option for "Clean solution". Try clicking that before you build it. Sometimes files get corrupted in your build and the thing needs to be built from scratch.

~psault
Build is checked and debug is selected. I tried cleaning the solution and it suceeded, but I got the same error when I tried to run the program.
Try to reinstall Visual C++ Express. I just installed mine and it works fine...
SHould I use the 2008 version, and should I download it right off of microsoft?
I downloaded 2008 again, and the same thing happened.
Fixed the problem. I changed the code to this:
// helloworld2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>

int _tmain(int argc, _TCHAR* argv[])
{
std::cout<< "welcome to C++!\n";
system("pause");
return 0;
}

Pages: 12