Zobacz wyniki ankiety na temat zarobków programistów w Polsce. Czytaj więcej..
2

Witam,

potrzebuję użyć w moim projekcie shared_ptr<> z biblioteki boost. Jednak podczas próby kompilacji VS wypluwa mi błędy. Nie są to błędy spowodowane błędnym linkowaniem, ponieważ inne programy korzystające z biblioteki boost działają poprawnie i kompilują się.

Napisałem najprostszy program z użyciem shared_ptr i także się nie kompiluje:

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
    boost::shared_ptr<int> p;
    p.reset(new int(3));
    p.reset();
    return 0;
}

A VS wypluwa następujące błędy:

 Error  1   error C2039: 'shared_ptr' : is not a member of 'boost'  d:\dev\code\c++\pierwsza gra\test\test\test.cpp 9   test
Error   2   error C2065: 'shared_ptr' : undeclared identifier   d:\dev\code\c++\pierwsza gra\test\test\test.cpp 9   test
Error   3   error C2062: type 'int' unexpected  d:\dev\code\c++\pierwsza gra\test\test\test.cpp 9   test
Error   4   error C2065: 'p' : undeclared identifier    d:\dev\code\c++\pierwsza gra\test\test\test.cpp 10  test
Error   5   error C2228: left of '.reset' must have class/struct/union  d:\dev\code\c++\pierwsza gra\test\test\test.cpp 10  test
Error   6   error C2065: 'p' : undeclared identifier    d:\dev\code\c++\pierwsza gra\test\test\test.cpp 11  test
Error   7   error C2228: left of '.reset' must have class/struct/union  d:\dev\code\c++\pierwsza gra\test\test\test.cpp 11  test

Z góry dziękuję za każdą odpowiedź. Pozdrawiam

flag
Ale jesteś pewien, że cały include masz? ;-> – nilphilus Mar 27 at 16:47
Możesz napisać co masz w stdafx.h ? – Bayger Mar 27 at 17:56

1 Answer

1

Problem rozwiązany, aż głupio się przyznać. Wystarczyło dodać na początku:

#include <boost/shared_ptr.hpp>
link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.