title: Expected primary-expression before 'void' Compiler: TDM-GCC 4.6.1 64-bit
body: <p>How to fix [Error] expected primary-expression before 'void' Compiler: TDM-GCC 4.6.1 64-bit on this code</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;pthread.h&gt;
  #include &lt;stdlib.h&gt;
  
  using namespace std;
  
  #define NUM_THREADS     5
  
  int main ()
  {
  pthread_t threads[NUM_THREADS];
  int rc;
  int i;
  for( i=0; i &lt; NUM_THREADS; i++ ){
    cout &lt;&lt; "main() : creating thread, " &lt;&lt; i &lt;&lt; endl;
   **rc = pthread_create(&amp;threads[i], NULL, void * (*threadid *PrintHello));**
    if (rc){
       cout &lt;&lt; "Error:unable to create thread," &lt;&lt; rc &lt;&lt; endl;
       exit(-1);
    }
   }
  pthread_exit(NULL);
  }
  
  void *PrintHello(void *threadid)
  {
  intptr_t tid;
    tid = (intptr_t) threadid;
     cout &lt;&lt; "Hello World! Thread ID, " &lt;&lt; tid &lt;&lt; endl;
    pthread_exit(NULL);
  
    }
  </code></pre>
  
  <p>How do i go about fixing this error any help is welcome thanks in advance!</p>
  
  <p>EDIT! Here is the exact compiler complaints</p>
  
  <pre><code>Compiler: TDM-GCC 4.6.1 64-bit
  Executing  g++.exe...
  g++.exe "C:\Users\Thomas\Documents\c++\stuff\threads.cpp" -o       "C:\Users\Thomas\Documents\c++\stuff\threads.exe"  -march=pentium2 -mtune=pentium2 -msse2 -   O2 -m32 -std=gnu++98 -pg -g3  -I"C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-   mingw32\include"  -L"C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib" -static-libgcc -m32 -pg -g3
  C:\Users\Thomas\Documents\c++\stuff\threads.cpp: In function 'int main()':
  C:\Users\Thomas\Documents\c++\stuff\threads.cpp:16:45: error: expected primary-expression before 'void'
  
  Execution terminated
  
  
  [Error] expected primary-expression before 'void' 
  </code></pre>
  
  <p>EDIT again Added full error and the error is on this line</p>
  
  <p>rc = pthread_create(&amp;threads[i], NULL, void * (*threadid *PrintHello));</p>
  
  <pre><code>16 45 C:\Users\Thomas\Documents\c++\stuff\threads.cpp [Error] expected primary-expression before 'void' 
  </code></pre>
  
  <p>EDIT 3</p>
  
  <p>Thanks to paul R with his partial solution after making the changes stated i get this</p>
  
  <pre><code>Compiler: TDM-GCC 4.6.1 64-bit
  Executing  g++.exe...
  g++.exe "C:\Users\Thomas\Documents\c++\stuff\threads.cpp" -o "C:\Users\Thomas\Documents\c++\stuff\threads.exe"  -march=pentium2 -mtune=pentium2 -msse2 -O2 -m32 -std=gnu++98 -pg -g3  -I"C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\include"  -L"C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib" -static-libgcc -m32 -pg -g3
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libmingw32.a when searching for -lmingw32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libmingw32.a when searching for -lmingw32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libmoldname.a when searching for -lmoldname
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libmoldname.a when searching for -lmoldname
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libmingwex.a when searching for -lmingwex
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libmingwex.a when searching for -lmingwex
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libmsvcrt.a when searching for -lmsvcrt
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libmsvcrt.a when searching for -lmsvcrt
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libgmon.a when searching for -lgmon
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libgmon.a when searching for -lgmon
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libadvapi32.a when searching for -ladvapi32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libadvapi32.a when searching for -ladvapi32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libshell32.a when searching for -lshell32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libshell32.a when searching for -lshell32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libuser32.a when searching for -luser32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libuser32.a when searching for -luser32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libkernel32.a when searching for -lkernel32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libkernel32.a when searching for -lkernel32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libmingw32.a when searching for -lmingw32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libmingw32.a when searching for -lmingw32
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libmoldname.a when searching for -lmoldname
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libmoldname.a when searching for -lmoldname
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libmingwex.a when searching for -lmingwex
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libmingwex.a when searching for -lmingwex
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib/libmsvcrt.a when searching for -lmsvcrt
  c:/program files (x86)/dev-cpp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib\libmsvcrt.a when searching for -lmsvcrt
  C:\Users\Thomas\AppData\Local\Temp\ccZIOBl3.o: In function `Z10PrintHelloPv':
  C:/Users/Thomas/Documents/c++/stuff/threads.cpp:31: undefined reference to `_imp__pthread_exit'
  C:\Users\Thomas\AppData\Local\Temp\ccZIOBl3.o: In function `main':
  C:/Users/Thomas/Documents/c++/stuff/threads.cpp:17: undefined reference to `_imp__pthread_create'
  C:/Users/Thomas/Documents/c++/stuff/threads.cpp:23: undefined reference to `_imp__pthread_exit'
  collect2: ld returned 1 exit status
  
  Execution terminated
  </code></pre>
  
  <p>Any other ideas would be appreciated thanks again in advance.</p>