mingw ld找不到搜索路径中存在的某个库

时间:2014-02-06 07:08:15

标签: c gcc mingw ld

我使用vim + mingw,不知怎的,终端仍然是窗口命令 所以我谷歌它,并使用mintty。但是当运行vim时,它会永远挂起,直到我键入C-c 我找到this page ,和wana尝试winpty 但是当我编译它时,它出来了:

$ make
Linking ../build/console.exe
c:\mingw32\bin\ld.exe: cannot find -lpthread
c:\mingw32\bin\ld.exe: cannot find -luser32
c:\mingw32\bin\ld.exe: cannot find -lkernel32
c:\mingw32\bin\ld.exe: cannot find -ladvapi32
c:\mingw32\bin\ld.exe: cannot find -lshell32
collect2: ld returned 1 exit status
make: *** [../build/console.exe] Error 1

然后我尝试gcc -lpthread --verbose,它能够找到pthread.a。
然后我尝试ld -lpthread --verbose,输出是

==================================================
attempt to open /mingw/mingw32/lib/libpthread.dll.a failed
attempt to open /mingw/mingw32/lib/pthread.dll.a failed
attempt to open /mingw/mingw32/lib/libpthread.a failed
attempt to open /mingw/mingw32/lib/pthread.lib failed
attempt to open /mingw/mingw32/lib/libpthread.dll failed
attempt to open /mingw/mingw32/lib/pthread.dll failed
attempt to open /mingw/mingw32/lib\libpthread.a failed
attempt to open /mingw/lib/libpthread.dll.a failed
attempt to open /mingw/lib/pthread.dll.a failed
attempt to open /mingw/lib/libpthread.a failed
attempt to open /mingw/lib/pthread.lib failed
attempt to open /mingw/lib/libpthread.dll failed
attempt to open /mingw/lib/pthread.dll failed
attempt to open /mingw/lib\libpthread.a failed
attempt to open /usr/local/lib/libpthread.dll.a failed
attempt to open /usr/local/lib/pthread.dll.a failed
attempt to open /usr/local/lib/libpthread.a failed
attempt to open /usr/local/lib/pthread.lib failed
attempt to open /usr/local/lib/libpthread.dll failed
attempt to open /usr/local/lib/pthread.dll failed
attempt to open /usr/local/lib\libpthread.a failed
attempt to open /lib/libpthread.dll.a failed
attempt to open /lib/pthread.dll.a failed
attempt to open /lib/libpthread.a failed
attempt to open /lib/pthread.lib failed
attempt to open /lib/libpthread.dll failed
attempt to open /lib/pthread.dll failed
attempt to open /lib\libpthread.a failed
attempt to open /usr/lib/libpthread.dll.a failed
attempt to open /usr/lib/pthread.dll.a failed
attempt to open /usr/lib/libpthread.a failed
attempt to open /usr/lib/pthread.lib failed
attempt to open /usr/lib/libpthread.dll failed
attempt to open /usr/lib/pthread.dll failed
attempt to open /usr/lib\libpthread.a failed
attempt to open /mingw/mingw32/lib/libpthread.dll.a failed
attempt to open /mingw/mingw32/lib/pthread.dll.a failed
attempt to open /mingw/mingw32/lib/libpthread.a failed
attempt to open /mingw/mingw32/lib/pthread.lib failed
attempt to open /mingw/mingw32/lib/libpthread.dll failed
attempt to open /mingw/mingw32/lib/pthread.dll failed
attempt to open /mingw/mingw32/lib\pthread.lib failed
attempt to open /mingw/lib/libpthread.dll.a failed
attempt to open /mingw/lib/pthread.dll.a failed
attempt to open /mingw/lib/libpthread.a failed
attempt to open /mingw/lib/pthread.lib failed
attempt to open /mingw/lib/libpthread.dll failed
attempt to open /mingw/lib/pthread.dll failed
attempt to open /mingw/lib\pthread.lib failed
attempt to open /usr/local/lib/libpthread.dll.a failed
attempt to open /usr/local/lib/pthread.dll.a failed
attempt to open /usr/local/lib/libpthread.a failed
attempt to open /usr/local/lib/pthread.lib failed
attempt to open /usr/local/lib/libpthread.dll failed
attempt to open /usr/local/lib/pthread.dll failed
attempt to open /usr/local/lib\pthread.lib failed
attempt to open /lib/libpthread.dll.a failed
attempt to open /lib/pthread.dll.a failed
attempt to open /lib/libpthread.a failed
attempt to open /lib/pthread.lib failed
attempt to open /lib/libpthread.dll failed
attempt to open /lib/pthread.dll failed

然后我尝试find /mingw -name *pthread*输出

$ find /mingw -name *pthread*
/mingw/bin/pthreadGC2.dll
/mingw/bin/pthreadGCE2.dll
/mingw/include/pthread.h
/mingw/lib/libpthread.a
/mingw/lib/libpthread.dll.a
/mingw/lib/libpthreadGC2.a
/mingw/lib/libpthreadGC2.dll.a
/mingw/lib/libpthreadGCE2.dll.a
/mingw/mingw32/include/pthread.h
/mingw/mingw32/lib/libpthread.a
/mingw/mingw32/lib/libpthread.dll.a
/mingw/mingw32/lib/libpthreadGC2.a
/mingw/mingw32/lib/libpthreadGC2.dll.a
/mingw/mingw32/lib/libpthreadGCE2.dll.a
/mingw/msys/1.0/include/pthread.h
/mingw/share/doc/pthreads-w32
/mingw/share/doc/pthreads-w32/2.9.1/README.pthreads-w32-2.9.1-1-mingw32
/mingw/var/cache/mingw-get/packages/pthreads-w32-2.9.1-1-mingw32-dev.tar.lzma
/mingw/var/cache/mingw-get/packages/pthreads-w32-2.9.1-1-mingw32-dll.tar.lzma
/mingw/var/cache/mingw-get/packages/pthreads-w32-2.9.1-1-mingw32-doc.tar.lzma
/mingw/var/cache/mingw-get/packages/pthreads-w32-2.9.1-1-mingw32-lic.tar.lzma
/mingw/var/lib/mingw-get/data/mingw32-pthreads-w32.xml
哦,上帝,邪恶在哪里? \/
helppppppppppp:|

1 个答案:

答案 0 :(得分:1)

如果有人有兴趣,请检查您的配置脚本。当你将* nix \与windows /

搞错时,会出现这个问题