compile prob: sched.h (win32 POSIX threads) - pid_t

This is a discussion on compile prob: sched.h (win32 POSIX threads) - pid_t within the Windows Programming forums, part of the Platform Specific Boards category; Trying to compile a program that uses POSIX threads in windows... when I compile, I get the message: C:/Progra~1/Micros~3/VC98/include\sched.h(120) : ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    72

    compile prob: sched.h (win32 POSIX threads) - pid_t

    Trying to compile a program that uses POSIX threads in windows... when I compile, I get the message:

    C:/Progra~1/Micros~3/VC98/include\sched.h(120) : error C2040: 'pid_t' : 'int' differs in levels of indirection from 'void *'

    sched.h (120):
    typedef int pid_t;

    Note: when I compile an MSVC++ console application project that includes the same file, it compiles fine. The problem comes when I'm using a wrapper for cl.exe to make plugins for another app.

    If you need more info, let me know what you need. Hopefully someone has experienced this before?

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,643
    Where did sched.h come from? I don't have that include file in my VC98/include directory.


    gg

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    72
    Originally posted by Codeplug
    Where did sched.h come from? I don't have that include file in my VC98/include directory.
    Open source POSIX threads for Win32 project at Redhat:

    http://sources.redhat.com/pthreads-win32/

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,643
    There is probably something wrong with your code...not sched.h
    If the copiler points out any lines in your code, post it, or all of it. Zip it up and attach if its alot.

    gg

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    72
    Originally posted by Codeplug
    There is probably something wrong with your code...not sched.h
    If the copiler points out any lines in your code, post it, or all of it. Zip it up and attach if its alot.

    gg
    I would think the same thing, however, the code compiles fine in Linux, so you'd think there would be a good chance of it being happy in win32 as well.

    The only problem reported by the compiler is the one I listed - no other errors/warnings.

    I'll keep poking around, but if anyone else has any insight, please post your thoughts.

    I'll consider trimming out the sensitive code to post an example.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,643
    When I compile this code:
    Code:
    typedef void* pid_t;
    #include <sched.h>
    I get this error:
    c:\program files\microsoft visual studio\vc98\include\sched.h(120) : error C2040: 'pid_t' : 'int' differs in levels of indirection from 'void *'
    Are you including a *nix flavor of <sys/types.h> (ie not the windows version)? Or maybe using another library that defines pid_t.

    Put sched.h at the top of the file and the compiler will show you where the other definition is.

    gg

  7. #7
    Registered User
    Join Date
    Oct 2002
    Posts
    72
    Originally posted by Codeplug
    When I compile this code:
    Code:
    typedef void* pid_t;
    #include <sched.h>
    I get this error: Are you including a *nix flavor of <sys/types.h> (ie not the windows version)? Or maybe using another library that defines pid_t.

    Put sched.h at the top of the file and the compiler will show you where the other definition is.
    Well, your comment made me look into the libs I was including & my other includes... turns out I was not directly including sched.h in anything, nor were any of the files I included. It (sched.h) is part of the pthread lib, but the lib is already compiled (I just link it in) - so, out of sheer morbid curiosity, I moved sched.h to sched.h.old (mainly to see who was including it) and it compiled with no problems & no errors or warnings. The program works fine too...


    I know that's not a perma-fix, but I find it interesting... will continue to poke through the program to see what might be causing this.

    Thanks for the help so far
    Last edited by BrianK; 04-11-2003 at 05:55 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using POSIX threads in C on Linux
    By muthus in forum C Programming
    Replies: 1
    Last Post: 01-19-2008, 04:34 PM
  2. POSIX threads policy and priority
    By arunj in forum Linux Programming
    Replies: 2
    Last Post: 06-13-2006, 03:48 AM
  3. Replies: 1
    Last Post: 10-24-2005, 06:35 AM
  4. problem with win32 threads
    By pdmarshall in forum C++ Programming
    Replies: 6
    Last Post: 07-29-2004, 02:39 PM
  5. pthreads-win32 POSIX threads
    By c99 in forum C Programming
    Replies: 4
    Last Post: 02-24-2004, 05:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21