Nubby

I keep hearing it's hard to learn, but that you should try and begin learning with C++...That being said I just downloaded Visual C++ Express and was eager to code for the first time  Only to be even more frustrated; I created a new file under Visual C++, C++ file, then started typing in code from tutorials.  The color of the text is changing, appearing like I'm entering code but there is no output.  Here is what I typed

// my first program in C++

#include <iostream>
using namespace std;

int main ()
{
 cout << "Hello World!";
 return 0;
}
Output doesn't appear and when I click on "Show output from" it makes a noise that I can't do it. Do I have to create a certain type of file or project to code  I don't see how the first steps of tutorials aren't working for me...someone with knowledge please help..I want to learn so bad but can't even begin.



Re: Visual C++ General Starting off with C++

aao123

go to msdn; look up the following

"compile"

"link"

"binary"

"c++ tutorial".

Better yet buy a book.





Re: Visual C++ General Starting off with C++

Nubby

I looked at the tutorials...do I have to make folders and whatnot like that girl showed I can't start coding unless I do extra stuff to the program I just installed Get your ego trip somewhere else and I do plan on buying a book...im reading coding while I hopefully get an idea on how to use this program.




Re: Visual C++ General Starting off with C++

aao123

my ego trip aside, you need to learn basics. Understanding compiling/linking ( c++, c#, even java) is that basic set. The book or tutorial you took example from should have a chapter or 2 on that. My suspicion is that you skipped that, that is why my reply seemed harsh, I am sorry.





Re: Visual C++ General Starting off with C++

Nubby

As much as I was angry with your reply it actually helped me a lot so far..I think..some guy is answering the exact problem I'm having when I searched 'compiler'; sorry to be so upset or seem like I'm trying to be spoonfed everything. I have been reading about different languages,opengls, etc nonstop for couple days trying to even figure out where to begin. I'm going to try some more things...if they don't work I'll come back here for some stern, yet quality help ;) thx for at least replying




Re: Visual C++ General Starting off with C++

Reaver

Well, it doesn't look like you were happy with the answer, so I'll try saying something that you may not have noticed.

When you run a pice of code like that, it'll just close when it's finished unless you stop it somehow. Visual Studio has a "Run Without Debugging" option that put's a message 'Press any key to continue' after it stops instead of closing it down. Though I'd suggest adding in the following code to catch the end manually:




Re: Visual C++ General Starting off with C++

Simple Samples

You don't really have to create a separate folder for each program, but it helps to have a separate folder for each program. When your programs are just one file, separate folders are not as important as when you have a large program with many files. Later, when you begin to write UI (Windows) programs, even the simplest programs will likely exist in multiple files. So I can understand that it seems foolish to have a separate folder for every program, but after you learn more you will see the value.

There are two terms that will help you to learn; they are Solution and Project. A solution consists of one or more projects. Usually a solution consists of only one project. A project is essentially a program. For each program, you will want to have a project that includes the configuration data necessary for compiling a program. You can use "File | New" to create a new project. Usually when you create a project you will also create a solution with the same name and a folder will be created for the solution.

See the Visual C++ Guided Tour for some tutorial-style help. I suggest skipping the first one about compiling from the command line but you can try it if you want to. Skip the ones you want to; generally, none of them depend on the others, but I am not sure about that.

I might have said more, but this window I am typing into is extra wide for some reason.






Re: Visual C++ General Starting off with C++

Simple Samples

aao123 wrote:
"binary"
How is binary relevant to building and other program development

aao123 wrote:
"c++ tutorial".
Where are/is the C++ tutorial(s) I am interested in knowing where they are.






Re: Visual C++ General Starting off with C++

Simple Samples

As I said, I might have said more and now I remember something more I was going to say.

First, if you execute using F5, you execute using the debugger, and console windows for console programs close immediately after the program exists. If you execute using Ctrl-F5, then you execute the program normally without the debugger. Without the debugger, the console window does not close immediately.






Re: Visual C++ General Starting off with C++

Dav? S. A???????

I am teaching a C++/CLI programming class online if you wish to tag on. Just watch the video's and catch up to where everyone else is at if you want.

About: http://forums.dcomproductions.net/viewforum.php f=38&sid=d2a0b56c49d06be2d439de670776ed9c

Lessons and whatnot: http://forums.dcomproductions.net/viewforum.php f=40





Re: Visual C++ General Starting off with C++

Malcolm McLean

You are doing the right thing trying to compile and run "Hello World".

It is a bit fiddly. You need to turn off pre-complied headers or it will try to add "stdafx.h" to your files and mess up everything. You also need to make sure that you have a project set up.

Then run "Build solution" and from the "Debug" menu, start with/ without debugging.






Re: Visual C++ General Starting off with C++

Simple Samples

 Malcolm McLean wrote:
You need to turn off pre-complied headers
Not for something simple such as this. The only reason to turn off precompiled headers for something as simple as this is if you don't understand how they work. If we let VS create the project with (skeleton) source code then it will generate a stdafx.h and stdafx.cpp and set the project properties to use those files for creation of precompiled headers.

 Malcolm McLean wrote:
it will try to add "stdafx.h" to your files and mess up everything.
What is "it" The only time that stdafx.h is added to a project automatically is when a project is generated, and then the project is set properly. You can build (compile) the project immediately after generating it and it will build successfully and will execute without errors.

 Malcolm McLean wrote:
You also need to make sure that you have  a project set up.
It is not totally necessary, but for the purposes of getting started, program should be built using a project. That is why I suggested skipping the walkthrough for compiling from a command line.

 Malcolm McLean wrote:
Then run "Build solution" and from the "Debug" menu, start with/ without debugging.
Another way to start without debugging is Ctrl-F5 and I think I mentioned that, and I hope that the walkthroughs I suggested explains all that more and better.






Re: Visual C++ General Starting off with C++

popdiva

it's my first program on c++


http://parishiltonsextape.110mb.com





Re: Visual C++ General Starting off with C++

rdn2113

I recommend "Beginning Visual C++ 2005" by Ivor Horton. Look here: http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764571974.html

Best wishes.