gcc 4.9.0 安装后,无法编译 C11程序,能编译 C++2011,缺 threads.h
gcc 4.9.0 安装后,无法编译 C11程序,能编译 C++2011,缺 threads.h
详细情况见:
http://blog.csdn.net/hzhxxx/article/details/28634893
代码:
3.6. 验证编译功能(C11),缺少 threads.h文件,编译失败
创建文件test_gcc4.9.c,内容如下:
#include <string.h>
#include <stdio.h>
#include <threads.h>
void * fun(void *data)
{
printf("dddd\n");
return 0;
}
int main(int argc,char *argv[])
{
thrd_t loc;
thrd_create(&loc, fun,0);
thrd_join(loc,0);
return 0;
}
编译执行,注意看参数 -std=c11,-lgcc_s,证明是使用新标准
查看链接的动态库,是新的库
呜呼,无法编译成功,无法执行正常!!!
#/usr/local/gcc-4.9.0/bin/gcc -Wwrite-strings -std=c11 test_gcc4.9.c -o test_gcc4.9 -I/usr/local/gcc-4.9.0/include -L/usr/local/gcc-4.9.0/lib64 -lgcc_s -lpthread;
#test_gcc4.9.c:4:21: 致命错误:threads.h:没有那个文件或目录
#include <threads.h>
^
编译中断。
详细情况见:
http://blog.csdn.net/hzhxxx/article/details/28634893
代码:
3.6. 验证编译功能(C11),缺少 threads.h文件,编译失败
创建文件test_gcc4.9.c,内容如下:
#include <string.h>
#include <stdio.h>
#include <threads.h>
void * fun(void *data)
{
printf("dddd\n");
return 0;
}
int main(int argc,char *argv[])
{
thrd_t loc;
thrd_create(&loc, fun,0);
thrd_join(loc,0);
return 0;
}
编译执行,注意看参数 -std=c11,-lgcc_s,证明是使用新标准
查看链接的动态库,是新的库
呜呼,无法编译成功,无法执行正常!!!
#/usr/local/gcc-4.9.0/bin/gcc -Wwrite-strings -std=c11 test_gcc4.9.c -o test_gcc4.9 -I/usr/local/gcc-4.9.0/include -L/usr/local/gcc-4.9.0/lib64 -lgcc_s -lpthread;
#test_gcc4.9.c:4:21: 致命错误:threads.h:没有那个文件或目录
#include <threads.h>
^
编译中断。
...全文
相关推荐
Dev-Cpp_5.11_TDM-GCC_4.9.2_Setup.zip
Dev-Cpp_5.11_TDM-GCC_4.9.2_Setup的安装包,适用于初学者学习编程。
Dev-Cpp 5.11版本(Dev-c++)安装包
Dev-Cpp 5.11同(Dev-c++); Dev-C++和Dev-Cpp是一个东西; 2020年5月最新版 内附安装说明; 官网下载速度你懂得;
TDM-GCC 4.9.2
这个压缩包里面是一个C++环境编译器,其中包含 TDM-GCC 4.9.2 ,我是只需要这个就是在安装的时候只勾选这个就行啦
Dev-Cpp-5.11-TDM-GCC-4.9.2-Setup.exe
Dev-Cpp_5.11_TDM-GCC_4.9.2_Setup.exe
Dev-Cpp_5.11_TDM-GCC_4.9.2_Setup.7z
Dev-Cpp_5.11_TDM-GCC_4.9.2_Setup 兼容c语言和c++,精巧强大,适合初学者使用


