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 162403 [details] Using error I have a project that I have created from existing sources. I have a namespace and inside a class. In the namespace I have: using std::string; In the class I have a property of type string: string _window_title; Netbeans is giving me the following error: "Unable to resolve identifier string" I also have a line with the following code: this->_window_title.c_str() Netbeans complains of the following: "Unable to resolve identifier c_str" The code compiles just fine. I have set the project as c++14. I the attachment you can see the string issue and how it compiles just fine. Am I missing something?
Which GCC you are using? Which tools you are using (MinGW, Cygwin, MSYS2, ...)? Do you see bug in simple cases? For example: #include <string> namespace ABC { using std::string; class A { public: string s; }; }; int main(int argc, char** argv) { return 0; }
I am using msys2. I can still see the error in the example you gave. I have created a file named example1.cpp in a project that was created with existing sources and I get the same exact error.
Created attachment 162404 [details] Using error2
Forgot to add gcc version: gcc -v Relevant output: gcc version 6.2.0 (Rev2, Built by MSYS2 project)
Confirmed. Bug can be reproduced with GCC 6.2. Test platform: Ubuntu 16.10 nightly build.
In modern GCC a 'string' class exists in std::__cxx11 inline namespace and IDE can't find this class in std namespace. In my environment it is a "valid" code: #include <string> namespace ABC { using std::__cxx11::string; class A { public: string s; }; }; int main(int argc, char** argv) { return 0; }
Created attachment 162411 [details] screenshot - Unable to resolve identifier string.
Forgot to add comments to previous attachment: I'm seeing the same thing. See attachment for a screenshot of a simple example.
I can not reproduce this on my Ubuntu 12.4 with g++ 4.9.3. But I can reproduce this on remote Ubunti 16.10 on VirtualBox with the default gcc 6.2.0
That's because of inlining of the cxx11 namespace into std, see /usr/include/i386-linux-gnu/c++/6/bits/c++config.h:224 The minimal example that does not involve system headers is as follows: namespace my_std { namespace my_cxx11 { template<typename T> class my_basic_string { }; typedef my_basic_string<char> my_string; } inline namespace my_cxx11 { } class my_std_class { my_string str; }; } int main(int argc, char** argv) { using my_std::my_string; my_string x; // unresolved; but compiles OK return 0; }
Even more simple example. It seems that the problem is in using directive that refers to an inlined namespace member. Other use cases seem to work well namespace my_outer { inline namespace my_inner { class my_class { }; } } void foo() { using my_outer::my_class; my_class var; // unresolved although compiles OK }
fixed in 240a40fdaa36 (enum/release82)
Is there a guide on how to get this new version? I normally just get the stable version (currently 8.2)
I've just pushed change set into cnd-main: http://hg.netbeans.org/cnd-main/rev/441c2562d11e This means that it should get into daily build (http://bits.netbeans.org/download/trunk/nightly/latest/) soon (within a day I think). Also a patch that contains this and other fixes will be created; but the exact time frame for the patch not yet defined.
Integrated into 'main-silver', will be available in build *201610130002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/441c2562d11e User: Vladimir Kvashin <vkvashin@netbeans.org> Log: fixed #268419 - Error on string with using std::string (transplanted from 240a40fdaa36e7ac5b90718f47fbf3b3ab9b31d6)
Hey, Sorry to keep posting here but is there any way to get the version that has the fix without having to download netbeans with all the options? Currently I am just using netbeans for c/c++ and for php. I don't need to download the version with 220mb but I do need the version with this fix because something like std::vector is also triggering the error. I tried looking for a guide but the link: - http://bits.netbeans.org/dev/nightly/2016-10-14_00-02-33/ Doesn't give me many options. Either I download netbeans with java bundles or I download with everything. Thanks.
Created attachment 162512 [details] std::vector error
Created attachment 162513 [details] vector now works with using namespace std;
Hey, I just downloaded the latest version: Product Version: NetBeans IDE Dev (Build 201610140002) Java: 1.8.0_101; Java HotSpot(TM) 64-Bit Server VM 25.101-b13 Runtime: Java(TM) SE Runtime Environment 1.8.0_101-b13 System: Windows 10 version 10.0 running on amd64; Cp1252; en_GB (nb) I can now use std::string but I can't use std::vector (and std::string works even if I don't include the <string> header) I have attached a screenshot 2 screenshots. The attachment "std::vector error" shows netbeans highlighting an error which is not an error. The attachment "vector now works with using namespace std;" shows how adding namespace magically fixes everything. Both versions compile just fine by doing: g++ -Wall -g -std=c++14 -o vec_test vec_test.cpp
Here is the code in the screenshot: #include <iostream> #include <vector> using namespace std; int main(int argc, char** argv) { vector<int> a; //if you add std:: netbeans will highlight it as an error for (int i = 0; i < 10; i++) { a.push_back(i); } for (int i : a) { std::cout << i << " "; } std::cout << std::endl; return 0; }
The root cause is quite different, so I filed a separate issue 268582 in this respect. I'm closing this one as fixed.
*** Bug 268759 has been marked as a duplicate of this bug. ***
Code in Comment 10, Comment 11 and Comment 12 has been fixed. Original problem (Comment 2) is not a fixed.
Verified in patch1 build 2016-12-12.
*** Bug 269323 has been marked as a duplicate of this bug. ***
Second testcase has been fixed too in NetBeans 8.2 patch 1.