[smart_ptr] et [friend] erreur no known conversion for argument, cast de class dérivée
Bonjour,
Mon C++ est un peut rouillé alors je ne vois pas encore bien où peut être le problème sur cet exemple de code opensource, que j'essaye de compiler avec g++
J'ai condensé le code dans un seul fichier pour répéter l'erreur que voici :
Code:
1 2 3 4 5 6 7 8 9 10 11
|
g++ -c -Wall -Wno-unknown-pragmas -Wno-format -O3 -std=gnu++11 -DTIXML_USE_STL -I ~/code/ruby/gosu/MonkSVG/thirdparty/boost_1_55_0/ test_smart_ptr.cpp -o test_smart_ptr.o
test_smart_ptr.cpp: In function int main(int, char* const*):
test_smart_ptr.cpp:33:34: error: no matching function for call to MonkSVG::SVG::initialize(SVGHandler*)
svg_parser.initialize( &handler );
^
test_smart_ptr.cpp:33:34: note: candidate is:
test_smart_ptr.cpp:20:8: note: bool MonkSVG::SVG::initialize(MonkSVG::ISVGHandler::SmartPtr)
bool initialize( ISVGHandler::SmartPtr handler ) { return true; }
^
test_smart_ptr.cpp:20:8: note: no known conversion for argument 1 from SVGHandler* to MonkSVG::ISVGHandler::SmartPtr {aka boost::shared_ptr<MonkSVG::ISVGHandler>} |
le code source ici http://pastie.org/8809379#1
Pour moi, étant donné que SVGHandler dérive de MonkSVG::ISVGHandler, il devrait être éligible comme un boost::shared_ptr<ISVGHandler> (ligne 10) ?
après le code était prévu pour xcode sur mac et j'ai essayé de le compilé sous linux.
Le code original, une fois remis en place avec les contraintes GNU/linux, donne le même genre d'erreur. Le code est un peu ancien, j'ai pris la dernière version de boost.
J'ai essayé de remplacer les lignes 33 34 par…
Code:
1 2 3
|
MonkSVG::ISVGHandler::SmartPtr handler(new SVGHandler);
svg_parser.initialize( handler ); |
le compilateur aime encore moins…
Si vous voyez un truc flagrant, je suis preneur.
Cordialement,
Sylvain.