PDA

View Full Version : [SOLVED] auto_ptr not found despite including <memory>



Kschikan
July 28th, 2011, 08:07 PM
I'm trying to compile some cpptest suites, and GCC is telling me it can't find 'auto_ptr'. I searched around and saw the I needed to '#include <memory>', but I get the same error.

Under GCC 4.5.2 and Ubuntu 11.04, I get the following error:


kane@Griffin:~/battlecubes$ make tests
g++ -o test_suite test/*.cpp
test/AllTests.cpp: In function ‘int main()’:
test/AllTests.cpp:10:9: error: ‘auto_ptr’ was not declared in this scope
test/AllTests.cpp:10:29: error: expected primary-expression before ‘>’ token
test/AllTests.cpp:10:35: error: expected type-specifier before ‘ShipTest’
test/AllTests.cpp:10:35: error: expected ‘)’ before ‘ShipTest’
make: *** [tests] Error 1

When trying to compile the following file:


#include <cstdlib>
#include <memory>

#include "cpptest.h"

int main ( )
{
Test::Suite ts;

ts.add(auto_ptr<Test::Suite>(new ShipTest));

Test::TextOutput output(Test::TextOutput::Verbose);
return ts.run(output) ? EXIT_SUCCESS : EXIT_FAILURE;
}

Any ideas?

GeneralZod
July 28th, 2011, 08:41 PM
auto_ptr is in the "std" namespace.

Kschikan
July 28th, 2011, 08:49 PM
Well, that was so blindingly obvious I feel dumb. Thanks for the update!