CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Strange Pthread problem

  1. #1
    Join Date
    Dec 2009
    Posts
    11

    Strange Pthread problem

    I'm running Linux fedora 12 and I can't get this super simple example to complile:

    Code:
    #include <pthread.h>
    
    int main(void)
    {
        Pthread_create(0,0,0,0);
        return 0;
    }
    The command I run is:

    cc -Wall test.c -lpthread

    The output is:

    test.c: In function ‘main’:
    test.c:5: warning: implicit declaration of function ‘Pthread_create’
    /tmp/ccMpY5h7.o: In function `main':
    test.c.text+0x29): undefined reference to `Pthread_create'
    collect2: ld returned 1 exit status

    Why is the compiler complaining about "implicit declaration"?
    Why can't the linker link? (I clearly did -lpthread)

  2. #2
    Join Date
    Oct 2008
    Location
    Singapore
    Posts
    195

    Re: Strange Pthread problem

    The function name is pthread_create and not Pthread_create (i.e. it starts with a small p).

  3. #3
    Join Date
    Jan 2009
    Posts
    1,689

    Re: Strange Pthread problem

    I assume you're just playing around with it? The code you posted will crash.

    Most C libraries use all lowercase. I can't think of any that capitalize anything, even C++ libraries rarely capitalize the first letter

  4. #4
    Join Date
    May 2007
    Location
    Scotland
    Posts
    1,164

    Re: Strange Pthread problem

    Quote Originally Posted by ninja9578 View Post
    Most C libraries use all lowercase. I can't think of any that capitalize anything, even C++ libraries rarely capitalize the first letter
    Loki

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)