Eclipse 3.7 cannot resolve Types in C++ Editor

喜夏-厌秋 提交于 2019-12-01 16:32:16

The red underlines for common types are usually caused by not having your standard library in your include path. Look at your includes for your project... they are in the project properties. Ensure that your C++ includes have an entry that matches the C++ standard libs folders for the compiler you are using.

After hitting this problem and a search revealing two stack overflow questions hitting the same problem, I figured I would submit how I fixed it after it annoyed me enough to actually investigate.

I'm running Fedora and annoyingly, it has a stddef.h file in /usr/include/linux.... which is actually empty. So even though I had the compiler's stddef.h in the include path, the indexer was actually parsing this other empty file. So what needed done was:

Prefix your paths and symbols list with the compiler specific include path (in my case it was /usr/lib/gcc/x86_64-redhat-linux/4.7.2/include/) to avoid the other empty stddef.h from being parsed.

I'm using Eclipse (Mars.1 Release 4.5.1, Build id: 20150924-1200) with an ARM compiler (arm-none-eabi, 4.4.1). I had exactly the same problem as you. My former path was:

D:\test\CodeSourcery\Sourcery G++ Lite\lib\gcc\arm-none-eabi\4.4.1\include

Then i discovered another include directory (postfix: 'fixed') at the compiler directories:

D:\test\CodeSourcery\Sourcery G++ Lite\lib\gcc\arm-none-eabi\4.4.1\include-fixed

This fixed all my errors concerining type-misdetection (e. g. uint16_t).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!