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.
Created attachment 135933 [details] A few IDE screenshots. Netbeans' Code Assistance has problems using the clang C++ 11 standard library headers. I've spent countless hours trying to find an IDE which can do C++ 11 with clang and refactoring support, and Netbeans has come much closer to other IDEs. But it's still giving me headaches. Assuming the "Command line tools" package has been installed through Xcode (which installs clang and headers etc. to standard /usr/ locations: Steps to reproduce: * Delete Netbeans settings in ~/Library/Application Support/Netbeans * Start up the IDE. * Go to Preferences->C++->Build Tools, and delete "GNU" from the tools collection, leaving just clang as the default. See that Netbeans has correctly picked up clang and clang++ from /usr/bin/. * Go to the Code Assistance tab, then "C++ Compiler" tab. Add clang's C++ 11 standard library headers path, /usr/lib/c++/v1. Move it to the top of the includes list. * Create a new "C/C++ Application" project. * Keep all the defaults (Clang Tool Collection) * Go to Project properties, Build->C++ Compiler, change "C++ Standard" to C++ 11. * Also add "-stdlib=libc++" to the "Additional options" field to enable the linking of clang's C++ 11 standard library. It would be nice if Netbeans can offer this as an option somehow. Without this flag clang will use C++ 98 headers and library. * Verify that main.cpp has inherited the "C++ 11" language setting from the project. Now in main.cpp, enter the following program: ======================= #include <memory> #include <string> int main(int argc, char** argv) { std::shared_ptr<std::string> shared1{new std::string{"a string"}}; std::shared_ptr<std::string> shared2 = std::make_shared<std::string>("a string"); std::unique_ptr<std::string> unique1 = std::unique_ptr<std::string>{new std::string{"a string"}}; auto shared3 = std::make_shared<std::string>("a string"); return 0; } ======================= Build the project, and the build will succeed. By holding down Cmd (mac keyboard) and hovering over <memory> and <string> we can see that the path seen by Code Assistance is correct and pointing to the /usr/lib/c++/v1/{header} version (again, this is clang's C++ 11 standard library headers path). See attached screenshot "correct_header_path.png". However, the IDE has red squiggles under shared_ptr, unique_ptr, and string. The error is "Unable to resolve identifier shared_ptr". Even after choosing "Reparse Project" we still have this issue. See attached screenshot "red_squigglies.png" and "red_squiggly_error.png". Code completion doesn't work on these variables, except for the last "shared3" auto variable (strangely enough). It correctly picks up the methods of std::shared_ptr. It would seem Code Assistance is having problems parsing out the information it needs from these headers. Or something. This is really important to me and I'm sure a lot of other folks. C++ 11 support is really bad in all the IDEs I've tried. Xcode doesn't offer refactoring, Eclipse is a mess, so it would be great if Netbeans can get this working nicely.
Just another quick step you can perform to see the behaviour of this issue: * Go back to Preferences->C++->Build Tools, Code Assistance Tab. Move the ".../v1" include back down to the bottom. Code Assistance will now correctly highlight std::string (because it's using the C++ 98 headers) but fail on the C++ 11 specific details like std::unique_ptr. So this problem is specifically related to clang's "v1" C++ 11 standard library headers.
Thank you for detailed description. This can be reproduced on Ubuntu if you install clang on it ans select clang tool collection.
Sorry, my statement was wrong, I just didn't follow some steps. It works perfectly well on Ubuntu 12.04 with clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0): no red underscore, IDE hyperlinks to unique_ptr and shared_ptr successfully.
*** This bug has been marked as a duplicate of bug 238413 ***