I don’t understand why I cannot find make_shared from std::memory or std::tr1
include header.
I only see 1 version of gcc in my machine
ls -lh /usr/bin/g++
lrwxrwxrwx 1 root root 7 Sep 22 2012 /usr/bin/g++ -> g++-4.7
And I am using -std=c++11
tag in the project build property as well
My environment:ubuntu ecplise juno R2 CDT
#include <memory>
#include <tr1/memory>
int main()
{
std::tr1::shared_ptr<int> t = std::tr1::make_shared<int>(1);
std::shared_ptr<int> t = std::make_shared<int>(1);
}
Update:
The build in eclipse console window shows it is actually success, but the code editor keep red underline the shared_ptr and make_shared. I tried to rebuild index, clear project. Nothing can remove the error. Any suggestions?
16:15:09 **** Incremental Build of configuration Debug for project test ****
make all
Building target: test
Invoking: GCC C++ Linker
g++ -o "test " ./main.o
Finished building target: test
16:15:09 Build Finished (took 328ms)
Update 2:
Below link solved my issue Enable C++11 in Eclipse CDT (Juno/Kepler/Luna) indexer