Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Project builds without errors, but some semantic errors persist
Project builds without errors, but some semantic errors persist [message #1710703] Thu, 08 October 2015 14:14 Go to next message
William Frane is currently offline William FraneFriend
Messages: 3
Registered: October 2015
Junior Member
I'm new to Eclipse CDT and Eclipse generally, but have experience with other IDEs. I've configured a project to use MinGW-w64 by setting the project properties as follows:

  • Under C/C++ Build > Environment, the variable "MINGW_HOME" is set to C:\Program Files (x86)\mingw-w64\i686-4.9.2-posix-dwarf-rt_v4-rev4\mingw32 and "Replace native environment with specified one" is selected.
  • Under C/C++ Build > Settings > Tool Settings > GCC C++ Compiler > Dialect, "Language standard" is set to "ISO C++11 (-std=c++0x)".
  • Under C/C++ General > Preprocessor Include Paths, Macros, etc. > Providers, the only entries that are checked are "CDT User Setting Entries", "Exported Entries from Referenced Projects", and "CDT Managed Build Setting Entries". This is the default except I've unchecked "CDT GCC Built-in Compiler Settings MinGW".
  • Under C/C++ General > Paths and Symbols > Includes > GNU C++, I've added the following directories (incidentally, I do realize that letting MinGW-w64 install itself in "C:\Program Files (x86)" probably wasn't the best idea):

    • C:\Program Files (x86)\mingw-w64\i686-4.9.2-posix-dwarf-rt_v4-rev4\mingw32\include
    • C:\Program Files (x86)\mingw-w64\i686-4.9.2-posix-dwarf-rt_v4-rev4\mingw32\lib\gcc\i686-w64-mingw32\4.9.2\include
    • C:\Program Files (x86)\mingw-w64\i686-4.9.2-posix-dwarf-rt_v4-rev4\mingw32\i686-w64-mingw32\include\c++\i686-w64-mingw32
    • C:\Program Files (x86)\mingw-w64\i686-4.9.2-posix-dwarf-rt_v4-rev4\mingw32\i686-w64-mingw32\include\c++\backward
    • C:\Program Files (x86)\mingw-w64\i686-4.9.2-posix-dwarf-rt_v4-rev4\mingw32\i686-w64-mingw32\include\c++
    • C:\Program Files (x86)\mingw-w64\i686-4.9.2-posix-dwarf-rt_v4-rev4\mingw32\i686-w64-mingw32\include

With this project configuration, I'm able to build without any problems and the resulting program runs as expected. However, various semantic errors ("type [name] could not be resolved", etc.) are still listed in the Problems tab. I've tried deleting them, cleaning the project, and rebuilding the index, but the errors persist.

I'd like to configure the project such that these spurious semantic errors are eliminated; otherwise I imagine it might be difficult to distinguish between actual errors and these irrelevant ones.

Any suggestions would be appreciated!

Relevant details:

  • IDE: Eclipse IDE for C/C++ Developers (Version: Kepler Service Release 2; Build id: 20140224-0627)
  • Compiler: MinGW-w64 (Version: i686-4.9.2-posix-dwarf-rt_v4-rev4)
  • OS: Windows 7
Re: Project builds without errors, but some semantic errors persist [message #1711993 is a reply to message #1710703] Tue, 20 October 2015 15:32 Go to previous messageGo to next message
William Frane is currently offline William FraneFriend
Messages: 3
Registered: October 2015
Junior Member
I apologize for bumping my own post, but here's an update.

  • I've tried quite a few solutions to this problem, including numerous simple solutions recommended online that all seem to involve some combination of cleaning the project and freshening, updating, or rebuilding the index. Unfortunately, none has worked.
  • A side note: the minimal set of include paths necessary to build successfully with MinGW-w64 appears to be:

    • ${MINGW_HOME}/include
    • ${MINGW_HOME}/lib/gcc/i686-w64-mingw32/4.9.2/include
    • ${MINGW_HOME}/lib/gcc/i686-w64-mingw32/4.9.2/include-fixed
    • ${MINGW_HOME}/i686-w64-mingw32/include

    with "MINGW_HOME" set to "C:\Program Files (x86)\mingw-w64\i686-4.9.2-posix-dwarf-rt_v4-rev4\mingw32" as mentioned in my previous post. This set of paths is simply the Eclipse CDT defaults for MinGW altered to replace "mingw32" with "i686-w64-mingw32". Ideally, I'd like the indexer to work properly with only these include directories (since they're sufficient to build).
  • I read in a few places that the indexer isn't able to examine the contents of the subdirectories of the specified include directories (which some people claim leads to the many spurious errors found by the indexer but not encountered when actually compiling and linking). I wrote a script (attached just for reference) to list all the subdirectories of the directories above and then added them to the project's list of include directories. As might be expected, this resulted in the build failing. The indexer also generated more errors than it did with fewer include directories.

I suspect that manually adding some combination of the subdirectories within the four include directories listed above (rather than flooding the project's list of include paths with all the subdirectories) would remove the spurious errors. I'm going to try to identify which subdirectories should be included and which should be omitted for my current project, but I'd still welcome any suggestions regarding a better way to handle this.
Re: Project builds without errors, but some semantic errors persist [message #1712036 is a reply to message #1711993] Wed, 21 October 2015 03:09 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
"Under C/C++ General > Paths and Symbols > Includes > GNU C++, I've added the following ... "

it's the Indexer causing your error flags.
The normal place for informing the Indexer is Project ==> Properties ==> C/C++ General ==> Preprocessor Include Paths, Macros, etc.
The first sentence in Preprocessor Include Paths, Macros, etc. help is "Include paths and preprocessor macros for C/C++ indexer"

But there should be an entry in "Settings Entries" for Builtins. Not sure why they wouldn't be there already.
See: http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_general_sd_entries.htm&cp=10_4_7_0_4_6_0
The example is based on MingW. If the Builtins aren't in the Entries list go to the Providers tab and select them.
You may need to enter any include directories in your project under the User Settings entries.

Info on Providers: http://help.eclipse.org/mars/topic/org.eclipse.cdt.doc.user/reference/cdt_u_prop_general_sd_providers.htm?cp=10_4_7_0_4_6_1

After fixing the paths on the Preprocessor page, you will need to rebuild the index. Project ==> C/C++ Index ==> Rebuild

[Updated on: Wed, 21 October 2015 03:14]

Report message to a moderator

Re: Project builds without errors, but some semantic errors persist [message #1712177 is a reply to message #1712036] Wed, 21 October 2015 18:42 Go to previous message
William Frane is currently offline William FraneFriend
Messages: 3
Registered: October 2015
Junior Member
Thanks for responding, David.

The include directories I specified under C/C++ General > Paths and Symbols > Includes > GNU C++ are already listed on the Preprocessor Include Paths, Macros, etc. screen under the heading "CDT Managed Build Settings". I did read the documentation for this page earlier and assumed that this automatic duplication meant the indexer was already being informed of the include directories specified under Paths and Symbols.

Just in case, I tried duplicating the list of include directories within the "CDT User Setting Entries" category on the Preprocessor Include Paths, Macros, etc. screen (see attached screenshot) and rebuilding the index (as well as updating it, restarting Eclipse, and rebuilding it again), but the errors persist.
Previous Topic:Eclipse crashes when trying to run program. Windows 10
Next Topic:How commit file .cproject to SVN or git
Goto Forum:
  


Current Time: Tue Apr 23 07:14:53 GMT 2024

Powered by FUDForum. Page generated in 0.04110 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top