Page 3 of 4

Re: OOP X not declared! :@

Posted: Sun May 08, 2011 4:22 pm
by VoidElite
@N64vSNES VC++ 2010. :)

Re: OOP X not declared! :@

Posted: Sun May 08, 2011 4:23 pm
by N64vSNES
VoidElite wrote:Why should I? He was practically nailing me just because he has a biased view on conventions?
1) It's his forum
2) His views are normally the good ones
3) Take what he says and removed the bullshit and you'll find someone speaking sense.

Back on topic, have you gotten Visual Studio to link properly? I'm on skype if you want to message me about it.

Re: OOP X not declared! :@

Posted: Sun May 08, 2011 5:27 pm
by dandymcgee
VoidElite wrote: Why should I? He was practically nailing me just because he has a biased view on conventions?
FYI, the convention of not explicitly #including .cpp files is not biased, it's logical; and more of a standard than a convention. Many points have been made why it's important and should always be done that way. As Falco said (albeit quite bluntly), you are welcome to do it however you like, just know that any other way is blatantly incorrect by all C++ programming conventions.
N64vSNES wrote:
VoidElite wrote:If someone can tell me how the hell I get VC++ to link the Main.cpp with the other .cpps then maybe I'll consider it. ;)
Normal linking of your project should be done automatically when you click build. What version of Visual Studio are you using?
This is correct. There is no need to tell VC++ how .cpp files are associated with one another, as long as each .cpp #includes the headers it requires (I believe I said this already).

Are you still getting errors? If so, what are they?

Re: OOP X not declared! :@

Posted: Sun May 08, 2011 10:46 pm
by Falco Girgis
VoidElite wrote:
N64vSNES wrote:
VoidElite wrote:
GyroVorbis wrote:Jeeesus christ.

You have every right to embrace shitty programming practices, true, but I also have every right to judge you as an ignorant noob for doing so.

The way that you are structuring your code is enough to make any C/++ programmer laugh at you.
Thanks Falco, you're a very nice person. :(

As for me being a noob which I am not, I may be a noob at C++ OOP quite frankly because it's, I am certainly not a noob at Assembly language(Intel syntax), C#, PHP ext. I have experience with languages which do not use such conventions(part of the reason why I chose to un-implement it also the fact that I acknologe(spelling fail) why you would use such things and I choose not too is due to the fact that I think it makes my code hard to read, crummy and I don't like classes streching over multiple files. For example: if I want to change to operands or the return type of a function, I'd have to change it in two files which is not ergonomic at all.

Maybe later I will re-implement it but right now all I care about is my SATS exams tomos and getting the code working which it is not. :)
I'm just going to say for future reference: If Gyro bullies you, take it as a compliment. ;)
Why should I? He was practically nailing me just because he has a biased view on conventions?
Face. Fucking. Palm. You are CLEARLY the epitome if an ignorant newbie when it comes to C++. If I jumped head-first into C#, tried to do everything the C++ way, then bitched that people who tried to show me the correct way of doing it were arrogantly asserting their opinions upon me, I would most certainly be an ignorant (and annoying) newbie as well.

I have a biased view on conventions?

Conventions? You literally just took a shit on the entire reason intermediate .o files exist. You literally just took a shit on the linker. You literally just overlooked the entire reason there exists a separation between interface (.h) and implementation (.c/.cpp) files in C++. But no, I'm being biased? You clearly have no idea what you're talking about, and if you had taken ten seconds to research and consider our posts (rather than trying to mend your bruised ego), you would know that this is not a matter of opinion. This is a matter of right versus wrong. Correct versus incorrect. And you, homeslice, are completely fucking wrong. :)

I never judge people on a personal level based on their programming practices. But your inability to take advice (it didn't become CRITICISM until AFTER you ignored it), combined with the fact that you were so quick to turn your complete and total ignorance around in a pathetic attempt to make it sound like I was abrasively spouting my arrogant opinion, definitely makes me respect you less. My first post was helpful. I was the entire reason you even got any real help in the first place in this thread.
N64vSNES wrote:I'm just going to say for future reference: If Gyro bullies you, take it as a compliment.
Yes, being slightly irritated with somebody who refuses to take about a dozen posts of genuinely good advice is bullying. I was being helpful followed by being completely honest. I'm sorry, I'll have to remember that we should take the time to rub our penises together as a goodwill preamble before we get into any real programming discussion in the future... I hope that will be gentle enough for the princesses on these boards asking for C/++ help. :roll:

When I take the time to help people, I appreciate at least a small amount of respect in return.

Re: OOP X not declared! :@

Posted: Mon May 09, 2011 12:02 am
by like80ninjas
This isn't really going to help,
but I LOL'd at Falco's "rub our penis's together" comment

Re: OOP X not declared! :@

Posted: Mon May 09, 2011 9:08 am
by MrDeathNote
Gotta agree with Falco. C++ is NOT C#. C++ is NOT Java. You're ignoring pretty much every C++ coding standard there is. Those aren't conventions, they are standards. The number of times you have been told not the include cpp files, not to delete a pointer to this, not to put #ifndef guards around your cpp files. I appreciate that you're just learning C++ and that coming from a C# background makes it that much harder but ppl are giving you good advice and you're pretty much ignoring it. I would suggest you buy a good C++ book and read it the entire way through before continuing with your project because you're making it harder to break your C# habits by continuing on. In fact if you go through the tutorials at http://www.learncpp.com/ you'll come back, look at your current code and probably scrap the lot because you have made some exceptionally bad design moves and you do not know C++ well enough to take on a project this size.

Re: OOP X not declared! :@

Posted: Mon May 09, 2011 9:19 am
by N64vSNES
GyroVorbis wrote:
N64vSNES wrote:I'm just going to say for future reference: If Gyro bullies you, take it as a compliment.
Yes, being slightly irritated with somebody who refuses to take about a dozen posts of genuinely good advice is bullying. I was being helpful followed by being completely honest. I'm sorry, I'll have to remember that we should take the time to rub our penises together as a goodwill preamble before we get into any real programming discussion in the future... I hope that will be gentle enough for the princesses on these boards asking for C/++ help. :roll:

When I take the time to help people, I appreciate at least a small amount of respect in return.
Don't drag me into this, I told him not to do this countless times ;)

Either way, your attitude is not something to get wound up about.

Re: OOP X not declared! :@

Posted: Mon May 09, 2011 9:45 am
by VoidElite
@Falco I would like to apoligise if I have irritated you, which I did not mean too. I just didn't see the dire 'end of the world' necessaryness to use this 'standard'.

I clearly understand I have no choice in the matter and therefore I shall re-write parts of the code to support this design layout. But my aim was to fix the errors at hand(the base ones) but clearly that task is superfuless in somes eyes and that OOP is supposidly more important. If I remember correctly Falco it says on your profile on this very site in your dislikes this:
programmers who spend more time worrying about OO design than actual programming
Hmm...not to hit at you or to argue my friend but doesn't that seem a wee bit hypocritical? Considering the subject title of this post was not about file structure or project OOP as such, it was about a class error or flaw(s) in my code which I have yet to solve because I'm now going to have to port over to this design layout.

Just wanted to state my involvement in this what seems to have become a 'lecture'.

NOTE: I AM GOING TO IMPLEMENT THIS INTERFACE&IMPLEMENTATION STUFF AND I WASN'T IGNORING YOU I WAS PRIORITIZING.

Hope we can end this on a positive note. :)

Re: OOP X not declared! :@

Posted: Mon May 09, 2011 11:22 am
by Falco Girgis
Let me just tell you that part of the reason I initially responded to this thread (and even brought up the Makefiles) was because I (no joke) remember a time when I was 13-14 and did the EXACT same thing. It was because I was doing the whole Linux Dreamcast development environment thing and had no fucking clue what a Makefile was or how it worked. Needless to say, one of the fellow DC developers who wound up looking at my code was like "What in fuck's name are you including your .cpp files for!?"

I did it too.
VoidElite wrote:@Falco I would like to apoligise if I have irritated you, which I did not mean too. I just didn't see the dire 'end of the world' necessaryness to use this 'standard'.
It's all good. If I had taken more time to think about the fact that you were coming from a C# background (where file separation of implementation and interface is unheard of), I probably wouldn't have jumped straight up your ass as I did. ;)
VoidElite wrote:
me wrote:programmers who spend more time worrying about OO design than actual programming
Hmm...not to hit at you or to argue my friend but doesn't that seem a wee bit hypocritical? Considering the subject title of this post was not about file structure or project OOP as such, it was about a class error or flaw(s) in my code which I have yet to solve because I'm now going to have to port over to this design layout.
Trust me, I know the words you're quoting (my words), and I know what you're saying. But the truth of the matter is that (while you might not realize it, coming from a C# background and being new to C++), this really has nothing to do with object-oriented "particularities" (this is how straight-structural ANSI C works as well). This is a very fundamental black-and-white matter of how C/++ were designed to be compiled.

The good news for you is that if you're using Visual Studio... you literally just drag and drop files into your project, and the IDE handles all of that for you...

Re: OOP X not declared! :@

Posted: Mon May 09, 2011 12:37 pm
by VoidElite
GyroVorbis wrote:Let me just tell you that part of the reason I initially responded to this thread (and even brought up the Makefiles) was because I (no joke) remember a time when I was 13-14 and did the EXACT same thing. It was because I was doing the whole Linux Dreamcast development environment thing and had no fucking clue what a Makefile was or how it worked. Needless to say, one of the fellow DC developers who wound up looking at my code was like "What in fuck's name are you including your .cpp files for!?"

I did it too.
VoidElite wrote:@Falco I would like to apoligise if I have irritated you, which I did not mean too. I just didn't see the dire 'end of the world' necessaryness to use this 'standard'.
It's all good. If I had taken more time to think about the fact that you were coming from a C# background (where file separation of implementation and interface is unheard of), I probably wouldn't have jumped straight up your ass as I did. ;)
VoidElite wrote:
me wrote:programmers who spend more time worrying about OO design than actual programming
Hmm...not to hit at you or to argue my friend but doesn't that seem a wee bit hypocritical? Considering the subject title of this post was not about file structure or project OOP as such, it was about a class error or flaw(s) in my code which I have yet to solve because I'm now going to have to port over to this design layout.
Trust me, I know the words you're quoting (my words), and I know what you're saying. But the truth of the matter is that (while you might not realize it, coming from a C# background and being new to C++), this really has nothing to do with object-oriented "particularities" (this is how straight-structural ANSI C works as well). This is a very fundamental black-and-white matter of how C/++ were designed to be compiled.

The good news for you is that if you're using Visual Studio... you literally just drag and drop files into your project, and the IDE handles all of that for you...
OK. Glad your not angry/hating me/rubbing your penis on me. I'm going to implement the interface and implementation shiz then I'll send a field report back here. :)

Re: OOP X not declared! :@

Posted: Mon May 09, 2011 1:50 pm
by VoidElite
OK guys I have successfully implemented the 'standard'!

But now I'm back to step 1++... :(

Here are the current error's which as always have something to do with "Base* base2":
1>------ Build started: Project: Engine, Configuration: Debug Win32 ------
1> Trigger.cpp
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(20): error C2061: syntax error : identifier 'Base'
1> Sprite.cpp
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(9): error C2143: syntax error : missing ';' before '*'
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(20): error C2061: syntax error : identifier 'Base'
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\ai.h(9): error C2143: syntax error : missing ';' before '*'
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\ai.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\ai.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\object.h(9): error C2143: syntax error : missing ';' before '*'
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\object.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\object.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\base.h(9): error C2143: syntax error : missing ';' before '*'
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\base.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\base.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\sky.h(9): error C2143: syntax error : missing ';' before '*'
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\sky.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\sky.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\prop.h(9): error C2143: syntax error : missing ';' before '*'
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\prop.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\prop.h(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1> Sky.cpp
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(20): error C2061: syntax error : identifier 'Base'
1> Prop.cpp
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(20): error C2061: syntax error : identifier 'Base'
1> Object.cpp
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(20): error C2061: syntax error : identifier 'Base'
1> Main.cpp
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(20): error C2061: syntax error : identifier 'Base'
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\main.cpp(37): error C2660: 'Player::move' : function does not take 2 arguments
1> Globals.cpp
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(20): error C2061: syntax error : identifier 'Base'
1> Debugger.cpp
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(20): error C2061: syntax error : identifier 'Base'
1> Base.cpp
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(20): error C2061: syntax error : identifier 'Base'
1> AI.cpp
1>c:\users\marcareed\documents\visual studio 2010\projects\engine\engine\player.h(20): error C2061: syntax error : identifier 'Base'
1> Generating Code...
1> Compiling...
1> Player.cpp
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
OK, after all this I just wanted to say thank you and help me! :\

Re: OOP X not declared! :@

Posted: Mon May 09, 2011 2:48 pm
by Rapid Cube
show us the source files that are getting errors

Re: OOP X not declared! :@

Posted: Mon May 09, 2011 4:06 pm
by like80ninjas
Yes, post all the related files that have the errors.

Re: OOP X not declared! :@

Posted: Mon May 09, 2011 7:09 pm
by Ginto8
Your problem is that you're using Base in files that don't know what the hell it is. It's a type that hasn't been declared, so the compiler doesn't know what to do with it. Imagine I asked you for one hargled flormijiborb. The first thing you'd ask? "What're you smoking?" The second? "What's a hargled flormijiborb?" You're doing the same thing here.

Also, one of your errors appears to be forgetting a semicolon.

Re: OOP X not declared! :@

Posted: Tue May 10, 2011 2:08 am
by VoidElite
OK, it appears I've fixed part of it now I'm just getting linker errors anywhoo here's Globals.h's code:

Code: Select all

//setting bullshit
#ifndef GLOBALS_H
#define GLOBALS_H
#include <iostream>
#include <sstream>
#include <fstream>
#include <cmath>
#include <ctime>
#include "SDL.h"
#include "Windows.h"

using namespace std;

bool quit;
const int SCREEN_BPP=32;
const int SCREEN_WIDTH=800;
const int SCREEN_HEIGHT=480;
const int SPRITE_MAX=375;
const int SPRITE_WIDTH=32;
const int SPRITE_HEIGHT=32;
const int BASE_HEIGHT=50;
const string SPRITE_FOLDER="Sprites\\";
const string FOREGROUND_FOLDER="Foreground\\";
const string BACKGROUND_FOLDER="Background\\";
const string PLAYER_FOLDER=FOREGROUND_FOLDER+"Player\\";
const string AI_FOLDER=FOREGROUND_FOLDER+"AIs\\";
const string OBJECT_FOLDER=FOREGROUND_FOLDER+"Objects\\";
const string BASE_FOLDER=FOREGROUND_FOLDER+"Bases\\";
const string SKY_FOLDER=BACKGROUND_FOLDER+"Skys\\";
const string PROP_FOLDER=BACKGROUND_FOLDER+"Props\\";
const string BREAK="----------------------------------------------------------------------";

//bullshiz
bool checkCollision(SDL_Rect a,SDL_Rect b);

class Debugger;
class Sprite;
class Player;
class AI;
class Object;
class Base;
class Sky;
class Prop;
class Trigger;

#include "Debugger.h"
#include "Sprite.h"
#include "Player.h"
#include "AI.h"
#include "Object.h"
#include "Base.h"
#include "Sky.h"
#include "Prop.h"
#include "Trigger.h"
#endif
And the errors...:
1>------ Build started: Project: Engine, Configuration: Debug Win32 ------
1> Trigger.cpp
1> Sprite.cpp
1> Sky.cpp
1> Prop.cpp
1> Object.cpp
1> Main.cpp
1> Globals.cpp
1> Debugger.cpp
1> Base.cpp
1> AI.cpp
1> Generating Code...
1> Compiling...
1> Player.cpp
1> Generating Code...
1> LINK : C:\Users\MarcAReed\documents\visual studio 2010\Projects\Engine\Debug\Engine.exe not found or not built by the last incremental link; performing full link
1>Base.obj : error LNK2005: "bool quit" (?quit@@3_NA) already defined in AI.obj
1>Debugger.obj : error LNK2005: "bool quit" (?quit@@3_NA) already defined in AI.obj
1>Globals.obj : error LNK2005: "bool quit" (?quit@@3_NA) already defined in AI.obj
1>Main.obj : error LNK2005: "bool quit" (?quit@@3_NA) already defined in AI.obj
1>Object.obj : error LNK2005: "bool quit" (?quit@@3_NA) already defined in AI.obj
1>Player.obj : error LNK2005: "bool quit" (?quit@@3_NA) already defined in AI.obj
1>Prop.obj : error LNK2005: "bool quit" (?quit@@3_NA) already defined in AI.obj
1>Sky.obj : error LNK2005: "bool quit" (?quit@@3_NA) already defined in AI.obj
1>Sprite.obj : error LNK2005: "bool quit" (?quit@@3_NA) already defined in AI.obj
1>Trigger.obj : error LNK2005: "bool quit" (?quit@@3_NA) already defined in AI.obj
1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\Users\MarcAReed\documents\visual studio 2010\Projects\Engine\Debug\Engine.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any ideas what I can do to my forward declarations to solve this? :)