Results 1 to 5 of 5

Thread: Starting up: issue with pthread.h

  1. #1
    Join Date
    Jun 2009

    Default Starting up: issue with pthread.h

    Hi, I'm just now trying to get ClanLib setup for the first time. I followed the instructions fully (I think) and mostly everything worked. I created a new project (on a separate folder, on my desktop) and created a new file, and placed the code for the "hello world" example there. However, when I try to build, I get this error:

    c:\development\environment\include\clanlib\core\sy stem\mutex.h(44) : fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory

    I'm compiling this from VC++ 2008 Express (so on a windows machine of course). As I understand, POSIX threads shouldn't work in windows anyways. Could any of you kind folk suggest how I might be able to get past this error? =)

    I tried googling this one for a while with no luck.



  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Bergen, Norway


    The problem is that the define WIN32 is lacking in your project, and it tries to compile a linux version of the mutex class. We're not entirely sure why some users get this problem, while other don't - could be an Express issue.

    Anyway, to get this to work, you need to add some defines to your project. Not sure its the same in Express, but in Developer Studio 2008, I right click my project and select Properties. Under C/C++ and Preprocessor, add WIN32 to the Preprocessor Definitions. Remember to add it to both the Debug and Release configurations.

  3. #3
    ClanLib Developer
    Join Date
    May 2007


    That leads me onto the question, what is the correct (standard) way to determine platform differences?

    (This should be listed inside the CODING_STYLE file)

    For what I can see:

    Debug compile (Win32 and Linux)
    #define DEBUG

    Win32 defines (contained inside the property sheets)
    #define DIRECTINPUT_VERSION 0x0800
    #define NDEBUG (When when not debug compile)
    #define WIN32 (Win32 and win64 build)
    #define WINVER 0x0600
    #define _WIN32_WINNT=0x0600
    #define WIN64 (win64 build)

    These are also used (Indirectly defined or predefined). I am not sure if these are correct or required

  4. #4
    Master Sorcerer
    Join Date
    Sep 2006


    The Visual C++ defines are:

    _MSC_VER = To be used if its a Visual C++ specific feature
    _DEBUG = Indicates a debug build
    _M_IX86 = 32 bit build
    _M_X64 = 64 bit build
    _DLL = set if it links with MSVCRT*.DLL, not set if its a static C runtime
    _MANAGED = C++/CLI is enabled for this build
    _WIN32 = Windows build
    _WIN64 = Windows 64 bit build

    The 'cross compiler' Windows defines are:

    WIN32 = Windows build
    WIN64 = Windows 64 bit build
    UNICODE = Use UTF-16 for strings instead of the 8 bit ANSI character set

    Defines not to be used:

    DEBUG = The problem with this define is that it is also set for release builds that enable debugging information (.pdb files). I am not entirely sure if this problem still exist in newer Visual C++, since I always use _DEBUG instead, but it was a problem with VC 6.0.

    To detect the Mac platform, the __APPLE__ define should be used.

    My general approach is to check for WIN32 and __APPLE__ and if its none of those, then I assume it is unix. Hence the problems if Visual Studio projects fail to define WIN32. We could switch to _WIN32, but I don't know if mingw or other gcc based compilers for Windows define that, or if the Intel C++ compiler does so.

  5. #5
    Join Date
    Jun 2009


    Thank you! This solved the problem (and there is no way I could have found this solution on my own=p)


Similar Threads

  1. Graphic Overlay Issue
    By jmguy02 in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 04-07-2009, 02:53 AM
  2. ClanLib 0.9.0 (SVN) issue with GUIEditor
    By DfKimera in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 02-02-2009, 08:34 AM
  3. XML Attack State Issue
    By koss911 in forum Novashell Game Creation System
    Replies: 1
    Last Post: 12-11-2007, 10:28 PM
  4. New to Novashell and would like help starting
    By wackedoutbiker in forum Novashell Game Creation System
    Replies: 5
    Last Post: 03-31-2007, 09:08 PM
  5. Latest Beta Bug/Issue
    By SLATE in forum Funeral Quest
    Replies: 5
    Last Post: 09-03-2004, 06:09 AM



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts