Advertisement

Source code with errors: http://ideone.com/eSWKwf

Started by March 04, 2015 01:28 AM
3 comments, last by Brain 9 years, 10 months ago

How can I fix these errors. I tried to remove the errors with // but from that came out more different errors

Okay.

First: Your code was mangled when you copy-pasta'd. Here is the cleaned up code.
Second: You're missing a '#' for the preprocessor directive #define.
Third: In C++, it's usually more pragmatic to use a constant over a macro, but each is acceptable: const int SIZE = 10;
Fourth: You're missing a closing brace for your for loop after line 33.
Fifth: This has nothing to do with "3D" or "game programming" :|
Advertisement

A few more things which don't cause errors but caught my eye:

- position could be set to -1 once before the loop instead of every time within the loop

- "i <= SIZE - 1" is the same as "i < SIZE"

- I personally don't like to open namespaces, instead of "using namespace std" go with std::cout, etc., this is not a problem right now, but will be later on

Eh people, that looks like homework.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Eh people, that looks like homework.

I was about to say the same thing.

Also, you should avoid this:


using namespace std;

and instead, just pull in the symbols you want or reference them directly, e.g. std::cout. Using entire namespaces can introduce variable name clashes.

Edit: Ninja'd by Epi... ph34r.png

This topic is closed to new replies.

Advertisement