Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Add files to SFML  (Read 3844 times)

0 Members and 1 Guest are viewing this topic.

cpl

  • Newbie
  • *
  • Posts: 19
    • View Profile
Add files to SFML
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Add files to SFML
« Reply #1 on: January 25, 2009, 12:49:11 am »
???

Why do you want to do that?
Laurent Gomila - SFML developer

cpl

  • Newbie
  • *
  • Posts: 19
    • View Profile
Add files to SFML
« Reply #2 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

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Add files to SFML
« Reply #3 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...
SFML / OS X developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1485
    • View Profile
    • Blog
    • Email
Add files to SFML
« Reply #4 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? ;)

cpl

  • Newbie
  • *
  • Posts: 19
    • View Profile
Add files to SFML
« Reply #5 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Add files to SFML
« Reply #6 on: January 25, 2009, 05:22:49 pm »
You should really not do this. Just create your own library.
Laurent Gomila - SFML developer

cpl

  • Newbie
  • *
  • Posts: 19
    • View Profile
Add files to SFML
« Reply #7 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

quasius

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Add files to SFML
« Reply #8 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.