一个软件包中的一个example 我运行了下,编译能通过,但是link的时候出了一大堆错误,按网上说的改project-setting中的设置,没有效果:--------------------Configuration: wander - Win32 Debug--------------------
Linking...
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall ArRobot::run(bool)" (__imp_?run@ArRobot@@QAEX_N@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall ArRobot::addAction(class ArAction *,int)" (__imp_?addAction@ArRobot@@QAE_NPAVArAction@@H@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall ArRobot::comInt(unsigned char,short)" (__imp_?comInt@ArRobot@@QAE_NEF@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ArRobot::~ArRobot(void)" (__imp_??1ArRobot@@QAE@XZ)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall ArSonarDevice::~ArSonarDevice(void)" (__imp_??1ArSonarDevice@@UAE@XZ)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall ArActionStallRecover::~ArActionStallRecover(void)" (__imp_??1ArActionStallRecover@@UAE@XZ)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall ArActionBumpers::~ArActionBumpers(void)" (__imp_??1ArActionBumpers@@UAE@XZ)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall ArActionAvoidFront::~ArActionAvoidFront(void)" (__imp_??1ArActionAvoidFront@@UAE@XZ)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall ArActionConstantVelocity::~ArActionConstantVelocity(void)" (__imp_??1ArActionConstantVelocity@@UAE@XZ)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ArKeyHandler::~ArKeyHandler(void)" (__imp_??1ArKeyHandler@@QAE@XZ)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ArSimpleConnector::~ArSimpleConnector(void)" (__imp_??1ArSimpleConnector@@QAE@XZ)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static void __cdecl Aria::shutdown(void)" (__imp_?shutdown@Aria@@SAXXZ)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall ArSimpleConnector::connectRobot(class ArRobot *)" (__imp_?connectRobot@ArSimpleConnector@@QAE_NPAVArRobot@@@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall ArRobot::addRangeDevice(class ArRangeDevice *)" (__imp_?addRangeDevice@ArRobot@@QAEXPAVArRangeDevice@@@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall ArRobot::attachKeyHandler(class ArKeyHandler *,bool,bool)" (__imp_?attachKeyHandler@ArRobot@@QAEXPAVArKeyHandler@@_N1@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static void __cdecl Aria::setKeyHandler(class ArKeyHandler *)" (__imp_?setKeyHandler@Aria@@SAXPAVArKeyHandler@@@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall ArSimpleConnector::logOptions(void)const " (__imp_?logOptions@ArSimpleConnector@@QBEXXZ)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall ArSimpleConnector::parseArgs(void)" (__imp_?parseArgs@ArSimpleConnector@@QAE_NXZ)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ArSimpleConnector::ArSimpleConnector(int *,char * *)" (__imp_??0ArSimpleConnector@@QAE@PAHPAPAD@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static void __cdecl Aria::init(enum Aria::SigHandleMethod,bool,bool)" (__imp_?init@Aria@@SAXW4SigHandleMethod@1@_N1@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ArKeyHandler::ArKeyHandler(bool,bool)" (__imp_??0ArKeyHandler@@QAE@_N0@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ArActionConstantVelocity::ArActionConstantVelocity(char const *,double)" (__imp_??0ArActionConstantVelocity@@QAE@PBDN@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ArActionAvoidFront::ArActionAvoidFront(char const *,double,double,double,bool)" (__imp_??0ArActionAvoidFront@@QAE@PBDNNN_N@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ArActionBumpers::ArActionBumpers(char const *,double,int,int,bool)" (__imp_??0ArActionBumpers@@QAE@PBDNHH_N@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ArActionStallRecover::ArActionStallRecover(char const *,double,int,double,double)" (__imp_??0ArActionStallRecover@@QAE@PBDNHNN@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ArSonarDevice::ArSonarDevice(unsigned int,unsigned int,char const *)" (__imp_??0ArSonarDevice@@QAE@IIPBD@Z)
wander.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ArRobot::ArRobot(char const *,bool,bool,bool,bool)" (__imp_??0ArRobot@@QAE@PBD_N111@Z)
Debug/wander.exe : fatal error LNK1120: 27 unresolved externals
Error executing link.exe.wander.exe - 28 error(s), 0 warning(s)

解决方案 »

  1.   

    缺少了连接库文件(dll或lib).
    是什么我不清楚编译过了,证明头文件是有了,楼主需要把缺少的连接库文件加上才可以.
      

  2.   

    是不是有什么lib没有加进来?
    是不是.cpp没有加到工程里面?
      

  3.   

    C++我不太懂,现在是看看例子
    以前我们用的系统是用pascal类似的oberon编的,现在换新平台了,要用c++
    我们都不会,正在学,想先运行几个例子看看,但是连接不了。。平台的软件包我们买了,不知道是不是要都给他编译下? .dll 没看到,lib的文件夹我也加了
      

  4.   

    也可以不用改setting里面的东西,直接在stdafx.h里包含头文件及库文件,然后在你要用的地方包含stdafx.h就行了,如下:#include "头文件路径" 
                              #pragma comment(lib,"lib文件路径")
    这样链接时就不会出错了。
      

  5.   

    楼主缺的是Extension DLL(扩展dll)的链接库函数.有三种方法解决
    1 project->settings 选择link标签,在Object/library中将软件包中的lib文件加进去.(软件包中的lib与对应dll放到debug目录或vc的lib库中去).
    2 #pragma comment(lib,"lib文件目录及名称"),看debug不存在找不到头文件的错误,不#include的了.
    3 project->Add to project->Files;选择要导入的库文件,如*.lib,(这种方法最简便).
      

  6.   

    成功 多谢各位 呵呵 lib要手动写进去 还有就是dll