Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: D:/tc/tccore/CMakeFiles/CMakeScratch/TryCompile-5l0yk0
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_c658d.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:m && 适用于 .NET Framework MSBuild 版本 17.8.3+195e7f5a3
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.38.33133 版
cl /c /Zi /W1 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D CMAKE_HAVE_LIBC_PTHREAD /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_c658d.dir\Debug\\" /Fd"cmTC_c658d.dir\Debug\vc143.pdb" /external:W1 /Gd /TC /errorReport:queue "D:\tc\tccore\CMakeFiles\CMakeScratch\TryCompile-5l0yk0\src.c"
src.c
D:\tc\tccore\CMakeFiles\CMakeScratch\TryCompile-5l0yk0\src.c(1,10): error C1083: 无法打开包括文件: “pthread.h”: No such file or directory [D:\tc\tccore\CMakeFiles\CMakeScratch\TryCompile-5l0yk0\cmTC_c658d.vcxproj]
Source file was:
#include <pthread.h>
static void* test_func(void* data)
return data;
int main(void)
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_cancel(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);
return 0;
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: D:/tc/tccore/CMakeFiles/CMakeScratch/TryCompile-qpwg0i
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_1e5bd.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:m && 适用于 .NET Framework MSBuild 版本 17.8.3+195e7f5a3
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.38.33133 版
cl /c /Zi /W1 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D CHECK_FUNCTION_EXISTS=pthread_create /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_1e5bd.dir\Debug\\" /Fd"cmTC_1e5bd.dir\Debug\vc143.pdb" /external:W1 /Gd /TC /errorReport:queue "D:\tc\tccore\CMakeFiles\CMakeScratch\TryCompile-qpwg0i\CheckFunctionExists.c"
CheckFunctionExists.c
LINK : fatal error LNK1104:
无法打开文件“pthreads.lib”
[D:\tc\tccore\CMakeFiles\CMakeScratch\TryCompile-qpwg0i\cmTC_1e5bd.vcxproj]
Determining if the function pthread_create exists in the pthread failed with the following output:
Change Dir: D:/tc/tccore/CMakeFiles/CMakeScratch/TryCompile-gz72gi
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_be3d0.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:m && 适用于 .NET Framework MSBuild 版本 17.8.3+195e7f5a3
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.38.33133 版
cl /c /Zi /W1 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D CHECK_FUNCTION_EXISTS=pthread_create /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_be3d0.dir\Debug\\" /Fd"cmTC_be3d0.dir\Debug\vc143.pdb" /external:W1 /Gd /TC /errorReport:queue "D:\tc\tccore\CMakeFiles\CMakeScratch\TryCompile-gz72gi\CheckFunctionExists.c"
CheckFunctionExists.c
LINK : fatal error LNK1104: 无法打开文件“pthread.lib” [D:\tc\tccore\CMakeFiles\CMakeScratch\TryCompile-gz72gi\cmTC_be3d0.vcxproj]
cmake是出现这种情况,求大佬解惑!
查看完整内容
今天,编译程序的时候,意外遇到了一个错误,就是VS2008一直提示:fatal error LNK1104: 无法打开文件“libc.lib”,后来在网上查找了很多资料,终于知道原因了。。。
如果将用低版本的VC开发的项目,拿到高版本的VC开发环境上去编译,链接时也许会触发LNK1104错误。解决方案是链接时忽略此库,在此提供两种解决方案:
Project | Properties | Configuration Properties | Linker | Input Ignore Specific Library: libc.lib
解决 ...
今天,编译程序的时候,意外遇到了一个错误,就是VS2008一直提示:fatal error LNK1104: 无法打开文件“libc.lib”,后来在网上查找了很多资料,终于知道原因了。。。
如果将用低版本的VC开发的项目,拿到高版本的VC开发环境上去编译,链接时也许会触发LNK1104错误。解决方案是链接时忽略此库,在此提供两种解决方案:
Project | Properties | Configuration Properties | Linker | Input Ignore Specific Library: libc.lib
解决如下:项目->属性中->配置属性->链接器->输入->在忽略特定库中写入打不开的文件的名称libc.lib
在编译器里面写上代码:
#pragma comment(linker, "/NODEFAULTLIB:libc.lib")
只要忽略这个库即可。。。
复制粘贴中
|