Results 1 to 2 of 2

Thread: error: 'LPTHREAD_START_ROUTINE' undeclared(first use in this function)

  1. #1
    Join Date
    Mar 2011
    Beans
    1

    error: 'LPTHREAD_START_ROUTINE' undeclared(first use in this function)

    hi,

    i have this C code program to create thread:

    double dwThreadId1;
    CreateThread (NULL,
    0,
    (LPTHREAD_START_ROUTINE)&ThreadParam,
    0,
    &dwThreadId1,
    );

    when compiling, i receive these wornings and errors:

    warning: implicit declaration of function 'CreatThread'
    error: 'LPTHREAD_START_ROUTINE' undeclared(first use in this function)
    error:'LPVOID' undeclared (first use in this function)


    could anyone help me to resolve this problem ??

    Regards.

  2. #2
    Join Date
    Mar 2010
    Beans
    6

    Re: error: 'LPTHREAD_START_ROUTINE' undeclared(first use in this function)

    CreateThread is a windows function.

    On linux you need to use pthreads:

    Code:
     
    #include <pthread.h>
     
    pthread_t thread;
    double threadid;
    pthread_create(&thread,NULL,ThreadParam,&threadid);
    You will also need to change the definition of ThreadParam from probably
    Code:
    DWORD WINAPI ThreadParam(LPVOID *)
    to
    Code:
    void *ThreadParam(void *param)
    .

Tags for this Thread

Bookmarks

Posting Permissions

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