Eclipse C/C++问题+ Cygwin(抱怨一切)
所以我用 Cygwin 运行 Eclipse C/C++。
我可以顺利运行和编译:
我的 test.cpp 是:
#include <iostream>
using namespace std;
int main() {
cout << "This is a demonstration! \n";
sleep(10);
return 0;
}
我可以使用这个 makefile 成功构建:
**** Build of configuration Release for project HelloWorld ****
make all
Building file: ../test.cpp
Invoking: Cross G++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"test.d" -MT"test.d" -o "test.o" "../test.cpp"
cygwin warning:
MS-DOS style path detected: C:\Users\David\cworkspace\HelloWorld\Release
Preferred POSIX equivalent is: /cygdrive/c/Users/David/cworkspace/HelloWorld/Release
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Finished building: ../test.cpp
Building target: HelloWorld
Invoking: Cross G++ Linker
g++ -o "HelloWorld" ./test.o
Finished building target: HelloWorld
**** Build Finished ****
之后我得到 HelloWorld.exe,我可以正常运行。
我的问题是,日食抱怨一切!它说我有很多错误:
Description Resource Path Location Type
Function 'sleep' could not be resolved test.cpp /HelloWorld line 6 Semantic Error
Symbol 'cout' could not be resolved test.cpp /HelloWorld line 5 Semantic Error
Symbol 'std' could not be resolved test.cpp /HelloWorld line 2 Semantic Error
我的意思是,如果您阅读代码,显然情况并非如此。
我已经尝试过:
Index->Update with modified files
Index->Freshen all files
Index->Create parser log file
这是我在其他网站上找到的提示。
我该怎么解决这个问题呢?!
So im running Eclipse C/C++ with Cygwin.
I can run and compile smoothly:
My test.cpp is:
#include <iostream>
using namespace std;
int main() {
cout << "This is a demonstration! \n";
sleep(10);
return 0;
}
And I can successfully build with this makefile:
**** Build of configuration Release for project HelloWorld ****
make all
Building file: ../test.cpp
Invoking: Cross G++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"test.d" -MT"test.d" -o "test.o" "../test.cpp"
cygwin warning:
MS-DOS style path detected: C:\Users\David\cworkspace\HelloWorld\Release
Preferred POSIX equivalent is: /cygdrive/c/Users/David/cworkspace/HelloWorld/Release
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Finished building: ../test.cpp
Building target: HelloWorld
Invoking: Cross G++ Linker
g++ -o "HelloWorld" ./test.o
Finished building target: HelloWorld
**** Build Finished ****
After that I get HelloWorld.exe which I can run fine.
My problem is, eclipse complain on everything! It says ive got lots of errors:
Description Resource Path Location Type
Function 'sleep' could not be resolved test.cpp /HelloWorld line 6 Semantic Error
Symbol 'cout' could not be resolved test.cpp /HelloWorld line 5 Semantic Error
Symbol 'std' could not be resolved test.cpp /HelloWorld line 2 Semantic Error
I mean, this is obviously not the case if you read the code.
I have tried:
Index->Update with modified files
Index->Freshen all files
Index->Create parser log file
which was the tips i've found on other websites.
How should I tackle this problem?!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
test.cpp是dos还是unix文件?隐藏字符(例如行结尾)可能是问题所在。
尝试
unix2dos test.cpp
Is the test.cpp a dos or unix file? Hidden characters such line endings could be the issue.
Try
unix2dos test.cpp