c++ - header semaphore.h 不能包含 eclipse juno。我收到错误 "unresolved inclusion"

标签 c++ c eclipse

我正在尝试测试 C 语言多线程教程中的代码。我在 Windows 7、64x 上安装了 Eclipse JUNO、Mingw 和 Cygwin64。我还设置了变量路径。当我添加像 stdio.h、pthread_time.h 或 fcntl.h 这样的 header 时,我没有任何问题,但是当我尝试包含 header semaphore.h 或 pthread.h 时,Eclipse 给我错误“ Unresolved inclusion ”。谁能帮我?衷心感谢任何帮助。

[评论更新:]

我正在使用:适用于 C/C++ 开发人员的 Eclipse IDE 版本:Juno Service Release 2,我的 C++ 版本为 4.7.0。但请记住,我正在制作的程序是c。

这些是一些包含内容和我的做法:

#include <stdio.h> 
#include <pthread_time.h> 
#include <pthread_unistd.h> 
#include <semaphore.h> 
#include <pthread.h> 
#include <fcntl.h> 
#include<stdio.h>

int main(){
    printf("Hello World");
   }

正如我所说,并非所有人都遇到问题,但只有 semaphore.h 和 pthread.h 才出现错误。实际上,对于这样一个简单的程序,我不需要所有这些 header ,但这只是一个示例。

最佳答案

所以解决方案比我想象的更容易:只需使用 cygwin 而不是 mingw,将项目作为工具链即可。

关于c++ - header semaphore.h 不能包含 eclipse juno。我收到错误 "unresolved inclusion",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25958781/

相关文章:

c++ - 如何修复/重新设计模板递归依赖

c++ - new 后括号的存在,在 C++11 中做任何不同

java - Jar 访问外部文件

eclipse - 如何通过 SVN 在 Subclipse 中复制文件或项目?

c++ - 将 int* 转换为字符串,然后将字符串转换为 int*

c++ - 如何在 C++ 中的矩阵中搜索 vector 以及使用哪种算法?

c - 想要在 c 中打印矩阵元素的组合

c - 在管道之后恢复标准输入

c - 如何使构造函数中声明的变量在主文件中可见

android - 无法安装Android SDK 17