我读了很多帖子告诉我去链接器 - >输入 - >附加dependendancies并添加我做过的pthreadVC2.lib文件,但我仍然得到完全相同的错误 . 有谁知道问题是什么?对不起,我是pthread和堆栈溢出的新手这些是我的错误和代码:

1>  main.cpp

1>main.obj : error LNK2019: unresolved external symbol __imp__pthread_create referenced in function _main

1>main.obj : error LNK2019: unresolved external symbol __imp__pthread_exit referenced in function "void * __cdecl PrintHello(void *)" (?PrintHello@@YAPAXPAX@Z)

1>C:\Users\Gdizzle\Google Drive\Documents\Programming\Game\Project1\Debug\Project1.exe : fatal error LNK1120: 2 unresolved externals

`#include <pthread.h>`

`#include <stdio.h>`
`#define NUM_THREADS     5`


void *PrintHello(void *threadid)
{
   long tid;

   tid = (long)threadid;

   printf("Hello World! It's me, thread #%ld!\n", tid);

   pthread_exit(NULL);

   return threadid;
}

int main (int argc, char *argv[])
{
   pthread_t threads[NUM_THREADS];

   int rc;
   long t;
   `for(t=0; t<NUM_THREADS; t++){`

      printf("In main: creating thread %ld\n", t);

      rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
      if (rc){
         printf("ERROR; return code from pthread_create() is %d\n", rc);
         exit(-1);
         return 1;
      }
   }

   /* Last thing that main() should do */
   pthread_exit(NULL);
}

链接器commandLine说:

/ OUT:“C:\ Users \ Gdizzle \ Google Drive \ Documents \ Programming \ Game \ Project1 \ Debug \ Project1.exe”/ MANIFEST / NXCOMPAT / PDB:“C:\ Users \ Gdizzle \ Google Drive \ Documents \ Programming \ Game \ Project1 \ Debug \ Project1.pdb“/ DYNAMICBASE”pthreadVC2.lib“”kernel32.lib“”user32.lib“”gdi32.lib“”winspool.lib“”comdlg32.lib“”advapi32.lib“”shell32 . lib“”ole32.lib“”oleaut32.lib“”uuid.lib“”odbc32.lib“”odbccp32.lib“/ DEBUG / MACHINE:X86 / INCREMENTAL / PGD:”C:\ Users \ Gdizzle \ Google Drive \ Documents \编程\ Game \ Project1 \ Debug \ Project1.pgd“/ MANIFESTUAC:”level ='asInvoker'uiAccess ='false'“/ ManifestFile:”Debug \ Project1.exe.intermediate.manifest“/ ERRORREPORT:PROMPT / NOLOGO / LIBPATH :“C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ VC \ lib”/ TLBID:1