SFML community forums

Help => General => Topic started by: cpl on January 24, 2009, 07:45:09 pm

Title: Add files to SFML
Post by: cpl on January 24, 2009, 07:45:09 pm
Hi,

This is basically what I want to do:
Code: [Select]

#include <SFML/System.hpp>

int main()
{
    sf::AClock Clock;

    //Do something with clock

    return 0;
}


I want to add AClock.hpp and AClock.cpp to the System.hpp.
I have never done that before and I can't get it to work.
I'm using SFML v1.4 and CodeBlocks with MinGW on Windows XP.

I have tried a bit but I keep getting this error message "undefined reference to `sf::AClock::AClock(bool)'"

Any help is appreciated.
________
Ford Sierra history (http://www.ford-wiki.com/wiki/Ford_Sierra)
Title: Add files to SFML
Post by: Laurent on January 25, 2009, 12:49:11 am
???

Why do you want to do that?
Title: Add files to SFML
Post by: cpl on January 25, 2009, 08:41:06 am
Quote from: "Laurent"
???

Why do you want to do that?


Since I use AClock in every project (and  many other files as well) I thought it would be easier.
And I know this is not the best solution but for now I wanna do this  :)
________
easy vape (http://www.vaporshop.com/easy-vape-vaporizer.html)
Title: Add files to SFML
Post by: Hiura on January 25, 2009, 10:07:15 am
You use them, but the other don't.  :wink:
You can make your own "add-on lib" to the SFML, if you want.

I don't understand why this should help...
Title: Add files to SFML
Post by: Tank on January 25, 2009, 11:03:39 am
Adding things to a "foreign" namespace is never a good idea, and it can lead to confusion when others are reading your code.
Why don't you just use another namespace like mysf:: or whatever? ;)
Title: Add files to SFML
Post by: cpl on January 25, 2009, 05:16:22 pm
A friend helped me out today with this. Now it works perfectly.
I know this is generally a bad idea but at least now I got it to work...
________
iolite reviews (http://vaporizers.net/iolite-vaporizer)
Title: Add files to SFML
Post by: Laurent on January 25, 2009, 05:22:49 pm
You should really not do this. Just create your own library.
Title: Add files to SFML
Post by: cpl on January 26, 2009, 01:20:48 pm
Quote from: "Laurent"
You should really not do this. Just create your own library.


Yeah, I might do that if things starts to mess up. However this works pretty well right now and I think I'm gonna keep it this way (for now).
________
n02 vaporizer (http://no2vaporizers.com)
Title: Add files to SFML
Post by: quasius on January 26, 2009, 04:01:28 pm
Quote from: "cpl"
Quote from: "Laurent"
You should really not do this. Just create your own library.


Yeah, I might do that if things starts to mess up. However this works pretty well right now and I think I'm gonna keep it this way (for now).


When it stops working, you're going to have no idea why and get cryptic linker errors or erratic behavior.  Seriously.  Don't do this.  You don't really gain anything by stomping on SFML namespace anyway.