Erroneous "Unable to resolve identifier" in Netbeans

My program compiles fine, but Netbeans tells me "Unable to resolve id to_string".

I've tried everything in Netbeans 7.2 it shows "Unable to resolve identifier" although build succeeded "and I set" C ++ standard "to" C + +11 "in the code help options.

This is the only function that gives this problem so far. It is, however, also the first C ++ 11 feature I use, which leads me to believe that it has something to do with Netbeans without realizing that I am using C ++ 11, although I clearly state it in the support menu code.

Minimal example:

#include <string>
int main() {
    std::to_string(1);
}

      

EDIT: The same problem occurs when using nullptr

EDIT2: I suddenly realized that it might be important to mention that I am not using the generated Makefile, but SCons.

+3


source to share


4 answers


I know this question is seven months old, but since it came up as a second google search result, I'll share the answer I came up with. For Netbeans at least. Go to your project properties and make sure you have "C Compiler" -> "C Standard" installed to C11 and your "C ++ compiler" -> "C ++ Standard" installed to C ++ 11. You must install BOTH or it will still give false errors!



+11


source


Autocomplete and sometimes even syntax highlighting always fail in C ++. The more you dig deeper with C ++ and C ++ 11, the more Eclipse and Netbeans will start to underline everything with a red squiggly line. Some of my (correct and perfectly compiled) programs are a huge red squiggly line. I suggest you turn off error markers completely and you keep the autocomplete, but in many cases it just won't work and you should do your best.



+2


source


I had the same situation. This happened because I used a .c file instead of .cpp

+1


source


for Netbeans 8.2 (on Linux) only the following worked for me: Tools -> Options -> Code Help -> Macro Definitions: change: __cplusplus=199711L

in: __cplusplus=201402L

for C ++ 14 or __cplusplus=201103L

for C ++ 11

0


source







All Articles