SFML community forums

Help => General => Topic started by: Mindiell on August 18, 2007, 09:56:55 am

Title: includes files
Post by: Mindiell on August 18, 2007, 09:56:55 am
Hi,

I tried to compile the first example of the "Code::Blocks" tutorial, but I installed all include files on another directory than SFML/...
Thus, the compiler stop on this :
Code: [Select]
#include <SFML/System/Clock.hpp>
#include <SFML/System/Lock.hpp>
#include <SFML/System/Mutex.hpp>
#include <SFML/System/Randomizer.hpp>
#include <SFML/System/Sleep.hpp>
#include <SFML/System/Thread.hpp>


Can't it be a simple path just like this :
Code: [Select]
#include <System/Clock.hpp>
Title: includes files
Post by: Laurent on August 18, 2007, 10:53:11 am
You must keep SFML as the root directory for the SFML include files.

It is generally a good idea to have the library name as the root in the include directives, as it can contain very common file names that could also belong to other libraries (I'm sure I can find another library which include a <System/Clock.hpp> file).
With the library name as the first directory, it simply avoids conflicts.
Title: includes files
Post by: Alp on August 18, 2007, 10:54:55 am
Configuring the compiler's include paths can ease much the stuff.

Tell him to look at Path/To/SFML/include when searching headers in its include directories.
Title: includes files
Post by: Mindiell on August 18, 2007, 12:06:38 pm
I use sirectories like this on my projects :
Quote

Projects
  -- Project A
  -- Project B
  -- Externals objects
      -- Spriteobject
      -- Sceneobject
  -- Project C
  -- Externals libraries
       -- SDL
       -- SDL_image
       -- lua
       -- SFML

and each library directory contains :
Quote

Library directory
  -- include
  -- dlls
  -- lib


I, further, set compiler options like this (include example only there) :
Quote
- ..\External libraries\SDL\include
- ..\External libraries\SDL_image\include
- ..\External libraries\SFML\include


This is why I'm not using include\SFML\...
It's maybe strange, but I prefer this kind of directories architecture for updates : when I update SDL_image, I just delete the old directory and recreate a new, forgetting onthing...
Title: includes files
Post by: Alp on August 18, 2007, 12:10:54 pm
But inside SFML/include there must be a "SFML" directory.

If not, you can set it.
Title: includes files
Post by: Mindiell on August 18, 2007, 12:15:01 pm
Yep I deleted it :)

I tried changing all include files, and this is working properly.
But I've no more the orginial downloaded .hpp files...

Maybe, I'll try to change my architecture or convince you to change those damn includes :wink:
Title: includes files
Post by: Laurent on August 18, 2007, 12:28:59 pm
Quote
Maybe, I'll try to change my architecture or convince you to change those damn includes

These are not "damn includes" ;)
As I said, there is a good reason behind this choice, and even if it conflicts are unlikely to happen, it would be unsafe to do it the way you do.
Title: includes files
Post by: schmedly on August 22, 2007, 03:40:23 am
Quote from: "Mindiell"

Maybe, I'll try to change my architecture or convince you to change those damn includes :wink:


Don't tell me you do that sort of thing with the likes of Boost  :D
Title: includes files
Post by: Mindiell on August 22, 2007, 08:05:01 am
??? I'm not using boost.
And finally I changed all my architecture in order to use SFML  :wink: