CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

静态库能编译通过,但是动态库出错。

楼主ppfat()2004-11-02 09:56:25 在 VC/MFC / 基础类 提问

//fdb_visit.cpp  
  #include   <fastdb.h>  
  #include   <iostream>  
  #include   "open_olf_cim_db_dec.h"  
  #include   "open_olf_cim_db.h"  
  #include   "fdb_visit.h"  
  using   namespace   std;  
  void   fdb_visit()  
  {  
  dbCursor<BusbarSection>   busbar;  
   
  int   n   =   busbar.select();  
  if(   n   ==0   )  
  return;  
  do{  
  cout<<"name   is   "<<busbar->name<<endl;  
  }while(   busbar.next()   );  
   
  }  
   
  静态库编译成功,动态库编译提示  
  正在链接...  
  fdb_visit.obj   :   error   LNK2019:   无法解析的外部符号   "__declspec(dllimport)   public:   int   __thiscall   dbAnyCursor::select(void)"   (__imp_?select@dbAnyCursor@@QAEHXZ)   ,该符号在函数   "void   __cdecl   fdb_visit(void)"   (?fdb_visit@@YAXXZ)   中被引用  
  fdb_visit.obj   :   error   LNK2019:   无法解析的外部符号   "__declspec(dllimport)   public:   __thiscall   dbAnyCursor::~dbAnyCursor(void)"   (__imp_??1dbAnyCursor@@QAE@XZ)   ,该符号在函数   "public:   __thiscall   dbCursor<class   BusbarSection>::~dbCursor<class   BusbarSection>(void)"   (??1?$dbCursor@VBusbarSection@@@@QAE@XZ)   中被引用  
  fdb_visit.obj   :   error   LNK2019:   无法解析的外部符号   "__declspec(dllimport)   protected:   __thiscall   dbAnyCursor::dbAnyCursor(class   dbTableDescriptor   &,enum   dbCursorType,unsigned   char   *)"   (__imp_??0dbAnyCursor@@IAE@AAVdbTableDescriptor@@W4dbCursorType@@PAE@Z)   ,该符号在函数   "public:   __thiscall   dbCursor<class   BusbarSection>::dbCursor<class   BusbarSection>(enum   dbCursorType)"   (??0?$dbCursor@VBusbarSection@@@@QAE@W4dbCursorType@@@Z)   中被引用  
  fdb_visit.obj   :   error   LNK2001:   无法解析的外部符号   "public:   static   class   dbTableDescriptor   BusbarSection::dbDescriptor"   (?dbDescriptor@BusbarSection@@2VdbTableDescriptor@@A)  
  fdb_visit.obj   :   error   LNK2019:   无法解析的外部符号   "__declspec(dllimport)   public:   void   __thiscall   dbAnyCursor::fetch(void)"   (__imp_?fetch@dbAnyCursor@@QAEXXZ)   ,该符号在函数   "public:   class   BusbarSection   *   __thiscall   dbCursor<class   BusbarSection>::next(void)"   (?next@?$dbCursor@VBusbarSection@@@@QAEPAVBusbarSection@@XZ)   中被引用  
  fdb_visit.obj   :   error   LNK2019:   无法解析的外部符号   "__declspec(dllimport)   protected:   bool   __thiscall   dbAnyCursor::gotoNext(void)"   (__imp_?gotoNext@dbAnyCursor@@IAE_NXZ)   ,该符号在函数   "public:   class   BusbarSection   *   __thiscall   dbCursor<class   BusbarSection>::next(void)"   (?next@?$dbCursor@VBusbarSection@@@@QAEPAVBusbarSection@@XZ)   中被引用  
  Debug/fdb_dll.dll   :   fatal   error   LNK1120:   6   个无法解析的外部命令  
  其中dbCursor的定义如下  
  template<class   T>  
  class   dbCursor   :   public   dbAnyCursor   {    
      protected:  
          T   record;  
           
      public:  
          /**  
            *   Cursor   constructor  
            *   @param   type   cursor   type   (dbCursorViewOnly   by   default)  
            */  
          dbCursor(dbCursorType   type   =   dbCursorViewOnly)    
                  :   dbAnyCursor(T::dbDescriptor,   type,   (byte*)&record)   {}  
   
          /**  
            *   Cursor   constructor   with   explicit   specification   of   database.  
            *   This   cursor   should   be   used   for   unassigned   tables.    
            *   @param   aDb   database   in   which   table   lookup   is   performed  
            *   @param   type   cursor   type   (dbCursorViewOnly   by   default)  
            */  
          dbCursor(dbDatabase*   aDb,   dbCursorType   type   =   dbCursorViewOnly)  
                  :   dbAnyCursor(T::dbDescriptor,   type,   (byte*)&record)  
          {  
                  db   =   aDb;  
                  dbTableDescriptor*   theTable   =   db->lookupTable(table);  
                  if   (theTable   !=   NULL)   {    
                          table   =   theTable;  
                  }  
          } 问题点数:100、回复次数:10Top

1 楼vcleaner(我没当大哥很久了.......)回复于 2004-11-02 09:58:15 得分 20

setting中包含了LIB文件了吗?Top

2 楼DentistryDoctor(不在无聊中无奈,就在沉默中变态)回复于 2004-11-02 10:00:26 得分 20

busbar?它的.lib呢?Top

3 楼ProgramInHeart(珍惜每一天!)回复于 2004-11-02 10:03:58 得分 20

沙发Top

4 楼ppfat()回复于 2004-11-02 10:06:14 得分 0

BusbarSection是一个类,在open_olf_cim_db.h有定义和实现。Top

5 楼ppfat()回复于 2004-11-02 10:07:29 得分 0

同样的程序在静态库里面编译,在exe里面调用都是正确的。  
  什么地方有比较基本的关于dll的用法的资料啊?Top

6 楼ppfat()回复于 2004-11-02 10:14:50 得分 0

//open_olf_cim_db.h  
  class   BusbarSection   :public   Connector{  
  public:  
  int8 VoltageControlZone;  
  TYPE_DESCRIPTOR(   (SUPERCLASS(   Connector   ),   FIELD(VoltageControlZone)   )   );  
  };  
  //  
  #define   TYPE_DESCRIPTOR(fields)   \  
          dbFieldDescriptor*   dbDescribeComponents(dbFieldDescriptor*)   {   \  
                  return   &fields;   \  
          }   \  
          static   dbTableDescriptor   dbDescriptor    
   
  Top

7 楼ripyu(抢分的恶狼)回复于 2004-11-02 10:31:21 得分 20

头文件呢?包括了么?Top

8 楼oyljerry(【勇敢的心】→ ㊣提拉米苏√㊣)回复于 2004-11-02 10:32:31 得分 20

你的当前目录下有没有lib文件,是否导入到project中  
  Top

9 楼ripyu(抢分的恶狼)回复于 2004-11-02 10:32:58 得分 0

在setting要包含.lib文件的+了么?Top

10 楼yuantao(cfan)回复于 2004-11-02 11:50:09 得分 0

你没有包含lib文件.  
  直接在mfc的文件视图里把lib文件添加到工程里就可以了.  
   
  要看dll的详细资料,可以看window   核心编程.   详细,全面.  
  Top

相关问题

  • vbc编译动态库出错啦!!??
  • 在2000下编译的动态库,居然在98下调用出错!!但如果在98下编译就不会出错!!!Windows不是往下兼容的吗???
  • (在线等候)怎么把一个静态库的内容全部编译进一个动态库?
  • 动态库调用出错
  • CGI调动态库,出错?
  • VC动态链接程序转静态链接编译出错!
  • linux下怎样把一个静态库(libdemo.a)编译成一个动态库(libdemo.so),然后这个动态库(libdemo.so)可以不依赖静态库尔独立运行?
  • 编译出错
  • 编译出错??
  • 编译出错!!

关键词

  • 函数
  • 文件
  • db
  • dbcursor
  • dbanycursor
  • busbarsection
  • dbcursortype
  • fdb
  • dbdescriptor
  • dbcursorviewonly

得分解答快速导航

  • 帖主:ppfat
  • vcleaner
  • DentistryDoctor
  • ProgramInHeart
  • ripyu
  • oyljerry

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo