8

I'm receiving the above errors on all my C++ projects on Netbeans. I also receive cannot find errors for anything else I try to include. Here's what it says when I hold control and hover over it: https://i.sstatic.net/zrTwz.jpg. One of the projects actually builds and runs just fine, but all the rest fail either with "build failed, exit value 2" or the run fails with "run failed, exit value 127". I have absolutely no idea how to fix this and everything I've looked up to try to solve this hasn't helped. This wasn't a problem a few months ago when I was using Netbeans, and I'm not sure why the problem spontaneously popped up.

I just freshly installed Netbeans 8.0 and the latest cygwin version to try to fix this, but to no avail. I'm running Windows 7. Please help, it would be greatly appreciated.

EDIT The highlighted red errors in the attached photo are files/folders that do not actually exist. Could this be the problem, and if so, how can I go about fixing it?

EDIT 2 I deleted or changed some of the non-existent file/folder paths in the code assistance tab under the C/C++ tab under the options, this seems to have made some of the errors in the editor go away, but I still cannot build the project (and the errors haven't disappeared on this specific project), and the projects that I created in the past that used to work just fine are building, but I'm still receiving "RUN FAILED exit value 127".

6
  • What type of project did you create - gcc or Visual C++? Commented Apr 14, 2014 at 4:52
  • I'm not sure. How would I check? I'm just creating projects by going to file > new project > c/c++ application. This has always worked for me before. Commented Apr 14, 2014 at 4:55
  • Check this out it: netbeans.org/community/releases/60/cpp-setup-instructions.html Commented Apr 14, 2014 at 5:01
  • What am I supposed to do with that? That's for an older version of netbeans, and I already consulted a newer version of that installation page when reinstalling netbeans and cygwin earlier. Commented Apr 14, 2014 at 5:04
  • I'm having this same problem with a fresh install of Netbeans 8 and cygwin
    – Jan
    Commented Jul 24, 2014 at 19:08

2 Answers 2

9

I just had the same experience with Netbeans (8.0.2) not being able to find includes ("Cannot find include file") on Linux.

I had to do the following:

  1. In the "Build Tools" tab under "C/C++" settings, click "Restore Defaults" to let it rescan for the tools, after which it picked up the paths to all the executables. Select the newly configured toolset as default and/or delete the old one to reduce confusion.

enter image description here

  1. Under "Code Assistance", make sure the correct tool collection is selected, then click "Reset Settings" and "Apply". This populated all the necessary paths.

  1. In my project settings, made sure I was using the right (newly discovered) tool collection.

After this, all the includes were picked up correctly and errors disappeared from the source checking.

1
  • On Windows 7 / Netbeans 8.2, only the first step resolve my issue Commented Nov 16, 2016 at 12:32
5

I also had this problem (Cannot find include file iostream) in NetBeans IDE 8.1. I solved as follows:

Project properties -> Build -> C++ Compiler -> Basic Options -> C++ Standard -> C++98 or C++11 or C++14

This is the window

Not the answer you're looking for? Browse other questions tagged or ask your own question.