Just started C++ a few days ago need some help(hello world)
Hi im new to dev-archive
Im very new to C++ so I would appreciate it if people could fill me in on the terminology.
I thought for sure some one would have asked this already, but i don't see any posts concerning this.
I've been reading a little about C++ and I decided I should try to create the very simple "Hello World" program. I've looked at a few tutorials and they don't seem to address on how to execute the program. I've built it and this is what appears in the "output window" (not sure if that is what it is called :p):
1>-- Build started: Project: Hello World program, Configuration: Release Win32 --
1>Compiling...
1>Stdafx.cpp
1>Compiling...
1>Hello World program.cpp
1>AssemblyInfo.cpp
1>Compiling resources...
1>Linking...
1>Generating code
1>Finished generating code
1>Embedding manifest...
1>Build log was saved at "file://c:\Users\Erik\SkaR98\Hello World program\Hello World program\Release\BuildLog.htm"
1>Hello World program - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
and this is the code I created or wrote:
// Hello World program
#include <iostream>
#include <ostream>
int main()
{
std::cout << "Hello World!" << std::endl;
}
Im currently trying to figure out what Im doing wrong. I think I wrote the code wrong but as you can tell Im obviously not an expert , so I really don't know what im talking about:)
[1596 byte] By [
SkaR3D] at [2007-11-20 11:39:16]

# 1 Re: Just started C++ a few days ago need some help(hello world)
You built a console (i.e. command-line) program -- so open a command window, go to the directory where the executable you created is located, and run the executable you built. The output window is telling you that the executable file was built successfully, so just run it.
A lot of others will say to you to do all sorts of things with your application to get it to "halt" or some other thing. That's all well and good, but it teaches you absolutely nothing as to what you're running, where it's built, and how it should be run.
Regards,
Paul McKenzie
# 2 Re: Just started C++ a few days ago need some help(hello world)
OK, my fault you explained it very well, however I don't think I was asking the right question, so let me rephrase it. How do I make I program I wrote into an executable prgram? im sorry, now that I re-read it It does seem that I was asking on how to execute it.
SkaR3D at 2007-11-10 22:25:42 >

# 3 Re: Just started C++ a few days ago need some help(hello world)
console programs like that one are not meant to be ran as an executeable. You run that kind of program is ran through the command line. To make executeable programs, you have to use win32, assuming your using windows, but that is way ahead of you since you are just staring out, so basicly get used to using the command prompt to run you programs
# 4 Re: Just started C++ a few days ago need some help(hello world)
OK, my fault you explained it very well, however I don't think I was asking the right question, so let me rephrase it. How do I make I program I wrote into an executable prgram??
It's already been built. Look at the output:
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Regards,
Paul McKenzie