This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
All C++11 features in gcc are guarded with __GXX_EXPERIMENTAL_CXX0X__ preprocessor macro which is automatically defined by gcc when C++0x/C++11 mode is selected. Code Assistance does not define that macro in case of C++11 mode which causes a lot of invalid reported problems in the source code.
It seems that it's not needed if you use -std=c++11 flag instead of -std=c++Ox.
I will check that, but if I am not wrong gcc 4.6.3 which is still a default for Ubuntu does not support c++11 std flag yet.
(In reply to comment #2) > I will check that, but if I am not wrong gcc 4.6.3 which is still a default for > Ubuntu does not support c++11 std flag yet. We thought you use upcoming 4.8 :-) http://netbeans.org/bugzilla/show_bug.cgi?id=214184#c2
I am using and checking different compilers in different versions :-P BTW, does compilation flags setting in makefile (i.e. -std=c++11) has impact on Code Assistance preprocessor macros? If yes, than I am really impressed.
(In reply to comment #4) > I am using and checking different compilers in different versions :-P > BTW, does compilation flags setting in makefile (i.e. -std=c++11) has impact on > Code Assistance preprocessor macros? If yes, than I am really impressed. If you clean&build at least once from IDE, then it should magically detect it. Have a look nbproject/private/private.properties file content to make sure what was detected.
Strange. I do not have such a file. Here is my list of files: mpusz@mpusz-ubuntu:~$ ls -R NetBeansProjects/ttcnSimple/nbproject/ NetBeansProjects/ttcnSimple/nbproject/: configurations.xml Package-Default.bash private project.xml NetBeansProjects/ttcnSimple/nbproject/private: configurations.xml Default.properties private.xml Maybe that is why I have to click "Code Assistance" -> "Reparse Project" much too often in order to not see errors in the editor window.
(In reply to comment #6) > Strange. I do not have such a file. Here is my list of files: > > mpusz@mpusz-ubuntu:~$ ls -R NetBeansProjects/ttcnSimple/nbproject/ > NetBeansProjects/ttcnSimple/nbproject/: > configurations.xml Package-Default.bash private project.xml > > NetBeansProjects/ttcnSimple/nbproject/private: > configurations.xml Default.properties private.xml > > Maybe that is why I have to click "Code Assistance" -> "Reparse Project" much > too often in order to not see errors in the editor window. Vladimir mean nbproject/private/Default.properties
(In reply to comment #7) > (In reply to comment #6) > > Strange. I do not have such a file. Here is my list of files: > > Vladimir mean nbproject/private/Default.properties Exactly. Thanks.
Please, provide link on GNU documentation where predefined macros is defined.
Please see any of GCC C++11 headers. For example /usr/include/c++/4.6.3/tuple has: #ifndef __GXX_EXPERIMENTAL_CXX0X__ # include <bits/c++0x_warning.h> #else .......... #endif
main question: why _EXPERIMENTAL_? Which plans on gcc 4.9 and more?
All C++11 STL features in GCC 4.6.X, 4.7 and 4.8 have such a preprocessor macro that if not defined leads you to a compilation error. I really do not know why they still name it experimental as C++11 is an official stardard now. After your comments I tried to experiment a bit with the NB environment. I removed manually added macro in Code Assistance -> C++ Compiler -> Macro Definitions and after several rebuilds and Code Assistance -> Reparse Project it started to work without problems (no red errors reported beside ovveride that you fixed already and alternative function syntax). Well at least until the IDE shutdown. When I restart IDE I again have problems with red errors and have to reparse the project again.
So I still do not see any reason to add code assistance rule: "GNU compiler flags -std=c++11 and -std=c++Ox define predefined macros __GXX_EXPERIMENTAL_CXX0X__". As work around you can add this macros in Tools->Options->C/C++->Code Assistance->GNU->C++ Compiler->Macro Definitions. And file bag against GNU about using undocumented predefined macros.
"As work around you can add this macros in Tools->Options->C/C++->Code Assistance->GNU->C++ Compiler->Macro Definitions." That is exactly what I did before you added C++11 standard selection option and that is why I suggested adding that to IDE in first place. Now it seems to work better. Thanks for your support.
Please, reopen bug if you will find GNU documentation about such predefined macros.
(In reply to comment #10) > Please see any of GCC C++11 headers. For example /usr/include/c++/4.6.3/tuple > has: > > #ifndef __GXX_EXPERIMENTAL_CXX0X__ > # include <bits/c++0x_warning.h> > #else > > .......... > > #endif __GXX_EXPERIMENTAL_CXX0X__ is temporary macro. Valid C++ header is # if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) .... # endif
Alexander, let's analyzer output of -dM for different -std=... and update toolchain descriptor accordingly
Alexander, for 7.3 we can use simple approach without compiler call. On my system diff is (2 extra macros in output): #define __GXX_EXPERIMENTAL_CXX0X__ 1 #define __STRICT_ANSI__ 1
fixed, change set: http://hg.netbeans.org/cnd-main/rev/9b4b3a30122d
Integrated into 'main-golden', will be available in build *201210231040* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/9b4b3a30122d User: Alexander Simon <alexvsimon@netbeans.org> Log: fixed Bug #214186 __GXX_EXPERIMENTAL_CXX0X__ not set
*** Bug 215388 has been marked as a duplicate of this bug. ***
*** Bug 218632 has been marked as a duplicate of this bug. ***
*** Bug 219679 has been marked as a duplicate of this bug. ***
The issue is back with recent versions of gcc (using 4.8.0). They've changed the C++11 headers to : if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else __cplusplus 201103L needs to be set in netbeans when C++11 is enabled to fix the issue.
Please, file another issue.
filed separate https://netbeans.org/bugzilla/show_bug.cgi?id=230312