Very lost Java programmer...where do I start?

Jul 24, 2008 at 4:29pm
Hi, I'm James, and I'm from South Africa.

Anyway, I found this site, and read through lots of the C++ tutorials. It seems quite similar to Java. But now here is the problem.

However, I am very lost. I have WindowsXP, so I downloaded Visual C++ 2008 Express, installed it, and loaded it.
Now what? I can't find any tutorials on how to even CREATE a project in in VC++.
I tried creating one, and I ended up with weird header files (What are they? They are not covered in the tutorials), and what seemed like a main class, with 2 main methods?

main(void)
~main(void)


I can't seem to be able to do anything. I can't even get anything to compile or run. I just want to be able to print 'Hello World' and then I will be satisfied!
But right now I'm incredibly frustrated, and it seems I just have to somehow figure it all out myself. I might as well just return to programming Java. :(

Can someone at least explain just the basics of how this all works? I am completely clueless! I have read the tutorials, but they merely cover syntax and class structure. How would I have multiple classes?
Jul 24, 2008 at 4:51pm
You need to start with an empty project: File > New > Project > Empty Project. If your code isn't compiling, post it here for review. Here's your basic hello world:

1
2
3
4
5
6
7
8
9
10
11
12
// Basic Hello World Program
#include <iostream>
using namespace std;

int main()
{
	cout << "Hello World!\n";
	
	system("pause");
	return 0;
}


return 0;
Jul 24, 2008 at 6:22pm
I did that, however when I add a new class, it also adds a header file, and the class seems to come with code.

The class I create appears as:


1
2
3
4
5
6
7
8
9
#include "Blah.h"

Blah::Blah(void)
{
}

Blah::~Blah(void)
{
}


and the header as

1
2
3
4
5
6
7
8
#pragma once

class Blah
{
public:
	Blah(void);
	~Blah(void);
};


What is all this? I then deleted the header, and replaced the code of the class with that above example, compiled it...but now how do I run it?





Jul 24, 2008 at 7:59pm
Look through the top and look for 'Start without debugging'. I started out with Visual C++ as well (though a total beginner to programming) and I was really confused, especially about creating a project as well.

Maybe try Dev-C++. I think it's more straight forward. That's just my opinion though.

Jul 25, 2008 at 3:50am
You say you have read lots of C++ tutorials - which ones?

Most tutorials I have seen have examples in them. Try typing the code from the tutorial and getting it to work. If you have problems with that come back here.

Maybe you should learn how to use Google first - search "C++ tutorials code examples"!!
http://www.glenmccl.com/tutor.htm
http://www.codersource.net/codersource_cppprogramming.html
http://www.cprogramming.com/tutorial/lesson1.html
and many more with code examples....

I agree with Mike - use Dev-C++ first - it will help you understand C++ better.

Alan.
Last edited on Jul 25, 2008 at 3:52am
Jul 25, 2008 at 3:58am
This is probably exactly what you are looking for

http://msdn.microsoft.com/en-us/visualc/bb530677.aspx

Again. I think you should try Dev-C++, learn the syntax and junk of C++, then play with Visual Studio.

'You don't need a sledgehammer to break an egg'.
Topic archived. No new replies allowed.