【发布时间】:2012-06-18 17:54:53
【问题描述】:
我是这个论坛的新手,但在尝试寻找解决此问题的方法时,我已经看过几次了。我正在尝试使用我为 Ubuntu (libkml-dev_1.2.0-1ubuntu6_amd64) 找到的 C++ API 库生成要在 Google 地球中使用的 KML 文件。我使用命令 sudo apt-get install libkml-dev 安装了软件包,成功返回。之后,我使用命令行终端导航到示例文件夹,尝试使用命令 g++ helloworld.cc -o helloworld 执行程序“helloworld.cc”,但随后出现大量错误(主要声称 kmldom 是一个未定义的引用)。抱歉,我想附上文本文件,但不知道怎么做,所以我在下面提供了一个错误示例。我整周都在搜索,确保头文件确实包含在下载中,甚至就问题联系了谷歌地球开发人员(他们回答说他们与此无关,并重定向所有关于StackOverflow)。
有谁知道是什么导致了这个问题,我可以做些什么来解决这个问题,以便我继续前进?
/tmp/cc5u2JyV.o:在函数HelloKml(bool)': helloworld.cc:(.text+0x17): undefined reference to kmldom::KmlFactory::GetFactory()'
helloworld.cc:(.text+0x27): 未定义引用kmldom::KmlFactory::CreateCoordinates() const' helloworld.cc:(.text+0x328): undefined reference to kmldom::AsPoint(boost::intrusive_ptrkmldom::Element)'
/tmp/cc5u2JyV.o:在函数boost::intrusive_ptr<kmldom::Coordinates>::intrusive_ptr(kmldom::Coordinates*, bool)': helloworld.cc:(.text._ZN5boost13intrusive_ptrIN6kmldom11CoordinatesEEC2EPS2_b[_ZN5boost13intrusive_ptrIN6kmldom11CoordinatesEEC5EPS2_b]+0x3d): undefined reference to kmlbase::intrusive_ptr_add_ref(kmlbase::Referent*)'
/tmp/cc5u2JyV.o:在函数boost::intrusive_ptr<kmldom::Coordinates>::~intrusive_ptr()': helloworld.cc:(.text._ZN5boost13intrusive_ptrIN6kmldom11CoordinatesEED2Ev[_ZN5boost13intrusive_ptrIN6kmldom11CoordinatesEED5Ev]+0x23): undefined reference to kmlbase::intrusive_ptr_release(kmlbase::Referent*)'
/tmp/cc5u2JyV.o:在函数boost::intrusive_ptr<kmldom::Geometry>::intrusive_ptr(boost::intrusive_ptr<kmldom::Geometry> const&)': helloworld.cc:(.text._ZN5boost13intrusive_ptrIN6kmldom8GeometryEEC2ERKS3_[_ZN5boost13intrusive_ptrIN6kmldom8GeometryEEC5ERKS3_]+0x35): undefined reference to kmlbase::intrusive_ptr_add_ref(kmlbase::Referent*)'
collect2: ld 返回 1 个退出状态
【问题讨论】:
标签: c++ linux api terminal google-earth