C++ just beginning?????

Pages: 12
Jun 20, 2008 at 1:23am
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.
Jun 20, 2008 at 1:31am
It compile normal for me...
Can you place your errors here?
Jun 20, 2008 at 1:45am
what do you mean?
Jun 20, 2008 at 1:51am
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 Jun 20, 2008 at 1:59am
Jun 20, 2008 at 9:34am
If I use an Empty Project and add a new .cpp file and write that same code, it still does the build error thing.
Jun 20, 2008 at 9:38am
Can you post here your build error log?
It is the output window that appears at the bottom when you compile the file.
Jun 20, 2008 at 9:40am
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
Jun 20, 2008 at 3:01pm
you shall try the Batch build in the build menu
Jun 20, 2008 at 3:09pm
tried it, didn't work just said that there were 2 failed instead of one.
Jun 20, 2008 at 4:29pm
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).
Jun 20, 2008 at 4:31pm
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.
Jun 20, 2008 at 4:36pm
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.
Jun 20, 2008 at 5:27pm
by configuration the drop box is gray and just says n/a in it, and the configuration manager button is gray too, and unclickable.
Jun 20, 2008 at 6:47pm
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...
Jun 20, 2008 at 9:42pm
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
Jun 21, 2008 at 12:55am
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.
Jun 21, 2008 at 3:00am
Try to reinstall Visual C++ Express. I just installed mine and it works fine...
Jun 21, 2008 at 1:29pm
SHould I use the 2008 version, and should I download it right off of microsoft?
Jun 21, 2008 at 2:03pm
I downloaded 2008 again, and the same thing happened.
Jun 21, 2008 at 3:54pm
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