Re: OOP X not declared! :@
Posted: Sun May 08, 2011 4:22 pm
@N64vSNES VC++ 2010.
The Next Generation of 2D Roleplaying Games
http://elysianshadows.com/phpBB3/
1) It's his forumVoidElite 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.VoidElite wrote: Why should I? He was practically nailing me just because he has a biased view on conventions?
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).N64vSNES wrote:Normal linking of your project should be done automatically when you click build. What version of Visual Studio are you using?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.
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.VoidElite wrote:Why should I? He was practically nailing me just because he has a biased view on conventions?N64vSNES wrote:I'm just going to say for future reference: If Gyro bullies you, take it as a compliment.VoidElite wrote:Thanks Falco, you're a very nice person.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.
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.
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.N64vSNES wrote:I'm just going to say for future reference: If Gyro bullies you, take it as a compliment.
Don't drag me into this, I told him not to do this countless timesGyroVorbis wrote: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.N64vSNES wrote:I'm just going to say for future reference: If Gyro bullies you, take it as a compliment.
When I take the time to help people, I appreciate at least a small amount of respect in return.
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.programmers who spend more time worrying about OO design than actual programming
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:@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'.
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.VoidElite wrote: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.me wrote:programmers who spend more time worrying about OO design than actual programming
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.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.
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:@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'.
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.VoidElite wrote: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.me wrote:programmers who spend more time worrying about OO design than actual programming
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, after all this I just wanted to say thank you and help me! :\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 ==========
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
Any ideas what I can do to my forward declarations to solve this?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 ==========