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.
For example, let's create an empty C++ project and edit main.cpp so it looks like this: #include <mutex> #include <array> #include <iostream> int main(int argc, char** argv) { std::array<std::mutex, 2>; am am[1].lock(); am[1].unlock(); std::cout << "Lock & unlock succeed!\n"; return 0; } And change C++ standard to C++11 in project options, and add a compilation & linking flag --std=gnu++11. IDE will underline lock & unlock operators with red line, and will note autocomplete them, however, std::array provides operator[] which returns a reference to array element. This code will successfully compile and run. There was no such issue in NetBeans 7.4, everything worked fine.
Update, correcting typing errors. For example, let's create an empty C++ project and edit main.cpp so it looks like this: #include <mutex> #include <array> #include <iostream> int main(int argc, char** argv) { std::array<std::mutex, 2> am; am[1].lock(); am[1].unlock(); std::cout << "Lock & unlock succeed!\n"; return 0; } And change C++ standard to C++11 in project options, and add a compilation & linking flag --std=gnu++11. IDE will underline lock & unlock operators with red line, and will not autocomplete them, however, std::array provides operator[] which returns a reference to array element. This code will successfully compile and run. There was no such issue in NetBeans 7.4, everything worked fine.
(In reply to xecu91 from comment #1) > And change C++ standard to C++11 in project options, and add a compilation & > linking flag --std=gnu++11. Are you sure that your compiler works right with both flags? I.e. #g++ -c -g -std=c++11 -std=gnu++11 ... compile file without error? You should either use "C++ standard to C++11" or "compilation & linking flag --std=gnu++11".
(In reply to Alexander Simon from comment #2) > (In reply to xecu91 from comment #1) > > And change C++ standard to C++11 in project options, and add a compilation & > > linking flag --std=gnu++11. > Are you sure that your compiler works right with both flags? > I.e. > #g++ -c -g -std=c++11 -std=gnu++11 ... > compile file without error? > > You should either use "C++ standard to C++11" or "compilation & linking flag > --std=gnu++11". Yes. I just checked it. It compiles and runs correctly. If select just "C++ standart C++11" in project proerties, it won't build. OFFTOP: Actually, I thought keys -std=C++0x, -std=c++11 and -std=gnu++11 do the same thing, at least using gcc.
(In reply to xecu91 from comment #3) > (In reply to Alexander Simon from comment #2) > > (In reply to xecu91 from comment #1) > > > And change C++ standard to C++11 in project options, and add a compilation & > > > linking flag --std=gnu++11. > > Are you sure that your compiler works right with both flags? > > I.e. > > #g++ -c -g -std=c++11 -std=gnu++11 ... > > compile file without error? > > > > You should either use "C++ standard to C++11" or "compilation & linking flag > > --std=gnu++11". > > Yes. I just checked it. It compiles and runs correctly. If select just "C++ > standart C++11" in project proerties, it won't build. > > OFFTOP: Actually, I thought keys -std=C++0x, -std=c++11 and -std=gnu++11 do > the same thing, at least using gcc. Please, attach build log of simple application where you use both flags.
(In reply to Alexander Simon from comment #4) > (In reply to xecu91 from comment #3) > > (In reply to Alexander Simon from comment #2) > > > (In reply to xecu91 from comment #1) > > > > And change C++ standard to C++11 in project options, and add a compilation & > > > > linking flag --std=gnu++11. > > > Are you sure that your compiler works right with both flags? > > > I.e. > > > #g++ -c -g -std=c++11 -std=gnu++11 ... > > > compile file without error? > > > > > > You should either use "C++ standard to C++11" or "compilation & linking flag > > > --std=gnu++11". > > > > Yes. I just checked it. It compiles and runs correctly. If select just "C++ > > standart C++11" in project proerties, it won't build. > > > > OFFTOP: Actually, I thought keys -std=C++0x, -std=c++11 and -std=gnu++11 do > > the same thing, at least using gcc. > Please, attach build log of simple application where you use both flags. I did not use both flags. I selected C++ standard in project options -> C++ compiler -> C++11. And lower, additional parameters -> -std=gnu++11. Build log: "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering directory `/home/atk/NetBeansProjects/CppApplication_1' "/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/cppapplication_1 make[2]: Entering directory `/home/atk/NetBeansProjects/CppApplication_1' mkdir -p build/Debug/GNU-Linux-x86 rm -f "build/Debug/GNU-Linux-x86/main.o.d" g++ -std=gnu++11 -c -g -std=c++11 -MMD -MP -MF "build/Debug/GNU-Linux-x86/main.o.d" -o build/Debug/GNU-Linux-x86/main.o main.cpp mkdir -p dist/Debug/GNU-Linux-x86 g++ -std=gnu++11 -o dist/Debug/GNU-Linux-x86/cppapplication_1 build/Debug/GNU-Linux-x86/main.o make[2]: Leaving directory `/home/atk/NetBeansProjects/CppApplication_1' make[1]: Leaving directory `/home/atk/NetBeansProjects/CppApplication_1' СОБРАТЬ SUCCESSFUL (общее время: 475ms)
(In reply to Alexander Simon from comment #4) > (In reply to xecu91 from comment #3) > > (In reply to Alexander Simon from comment #2) > > > (In reply to xecu91 from comment #1) > > > > And change C++ standard to C++11 in project options, and add a compilation & > > > > linking flag --std=gnu++11. > > > Are you sure that your compiler works right with both flags? > > > I.e. > > > #g++ -c -g -std=c++11 -std=gnu++11 ... > > > compile file without error? > > > > > > You should either use "C++ standard to C++11" or "compilation & linking flag > > > --std=gnu++11". > > > > Yes. I just checked it. It compiles and runs correctly. If select just "C++ > > standart C++11" in project proerties, it won't build. > > > > OFFTOP: Actually, I thought keys -std=C++0x, -std=c++11 and -std=gnu++11 do > > the same thing, at least using gcc. > Please, attach build log of simple application where you use both flags. upd: actually, additional parameters is not necessary to build. But, issue still remains.
For me it works in dev version *** This bug has been marked as a duplicate of bug 242729 ***