I had several issues too (Ubuntu 13.04 64-bit, g++-4.8, eclipse Juno 3.8.1, CDT 6.0.0). A lot of things are mentioned above, sorry to repeat those, but additionally I had problems utilizing
std::thread
as part of c++11 (adding -pthread for the linker solves that issue). Anyway, finally these settings worked fine:
Project -> Properties -> C/C++ Build -> Settings -> Miscellaneous. Add the
-std=c++11
flag for the GCC and G++ compilers. Click Apply.
For the linker, same window, Miscellaneous, Linker flags, added the
-pthread
flag. Shared library settings, Shared object name, add the
-Wl,--no-as-needed
flag too. Click Apply.
C/C++ General -> Paths and symbols -> Symbols TAB, GNU C++ selected, Add the
__GXX_EXPERIMENTAL_CXX0X__
(no value)
flag. Click Apply.
C/C++ General -> Preprocessor Include paths.. -> Providers tab : check
CDT GCC built-in Compiler Settings
and for "Command to get compiler specs", add the
-std=c++11
flag. Uncheck Share. Click Apply.
CDT Managages Build Setting Entries, check this too. Uncheck the two others. Click Apply.
Going back to the Entries tab, GNU C++ CDT Managages Build Setting Entries, you should now see your added
__GXX_EXPERIMENTAL_CXX0X__
entry.
That's it. When coding, typing
std::
can now auto-complete the thread class for instance, builds should work fine and there should be no
std::system_error'what(): Enable multithreading to use std::thread: Operation not permitted
at runtime.
std::unique_ptr<char[]>
– Cubbiunique_ptr<char>
calldelete
, which is wrong since it was created withnew[]
? – Dietrich Eppdelete
to be called, when you needdelete[]
called. Theunique_ptr<char>
assumes that it's getting a pointer, which gets deleted withdelete
.unique_ptr<char[]>
expects an array, which gets deleted withdelete[]
correctly. – Nicol Bolas