Real beginner question about C++

Started by
7 comments, last by hotpixel 15 years, 8 months ago
What happens when you have a structure that is used in two classes? How do you get around Visual Studio complaining all the time about redefinition of structures in header files? And how do you stop it from entering an infinity loop because one header is included in another which links back to the first but is needed because it contains the structure??? Thanks, Andy
Advertisement
Include guards and forward declarations usually. Required reading on the subject.
many thanks ;)
Awesome, fixed my problem! I didn't know about forward declarations, considering I got taught this stuff at uni I'd say it was a pretty big thing to leave out!!!
Yes, you'll often find that most courses and classes on C++ are lacking in many, many ways.


You can look forward to several of these moments, where you find that your presumptions and your knowledge is seriously lacking and you have no idea what is wrong.

One of the worst, in my opinion, is copying of objects which use new and has delete in its destructor - that's heavy stuff to work out when you have no idea what's wrong or where it happens.

Just keep on going and don't give up - you're over a nasty hurdle already!
Student at NITH, Norway2nd year of Gameprogramming BachelordegreeC++ enthusiast
Quote:Original post by CodeLuggage
Yes, you'll often find that most courses and classes on C++ are lacking in many, many ways.


You can look forward to several of these moments, where you find that your presumptions and your knowledge is seriously lacking and you have no idea what is wrong.

One of the worst, in my opinion, is copying of objects which use new and has delete in its destructor - that's heavy stuff to work out when you have no idea what's wrong or where it happens.

Just keep on going and don't give up - you're over a nasty hurdle already!


Yeah when you first try to make a copy constructor for your classes without using references and they go into infinite recursion is an eye opener!
[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
Well I started in C++, I developed my final year project at uni in it using stereoscopic goggles and a wearable computer. What I did in C++/DX was pretty crude but the surrounding technology made it pretty impressive.

I then decided to back track and try to get my head around the more complex stuff in C#, HLSL, vertex shaders, pixel shaders, vertex buffers, animations, matrices etc once I had a nice looking environment in C# and I could actually understand some of the complexities of DX I then thought it was a good idea to move onto C++ and now I'm trying to master the complexities of that. I've converted most of my project and I'm amazed that it runs 200fps faster but looks exactly the same!!!

I'm not new to programming, I've been doing it for over 7 years now, .NET, Java, PHP, VB, Lingo, AS3 but C++ really is a different ball game to all those!

It makes me laugh when I remember my lecturer saying, "C++ is pretty much Java, same syntax you've just got these pointer things"!
Quote:Original post by hotpixel
Well I started in C++, I developed my final year project at uni in it using stereoscopic goggles and a wearable computer.

Did that help improve your code quality? I find good coffee and hard trance music helps me, but to each his own.

Stephen M. Webb
Professional Free Software Developer

LMFAO!

Here I am with a gigantic mug of coffee, listening to "Techno Radio ! Deep Electro Music Live From Paris France - Powered By RadioABF.net" and programming my project.

I don't know if you've ever used stereoscopic goggles but they are awesome, you pay out your nose for them but the experience is immense. You find the user is so wrapped up in the experience that they don't realise your game code is sh*t.

This topic is closed to new replies.

Advertisement