zoukankan      html  css  js  c++  java
  • Builld with gloox

    今天遇到一个C++编译问题。

    我用Gloox编译成dll,然后再自己写个C++ console,2个项目在一个解决方案中(这使我一顿被蒙蔽),去调用它,build error如下:

    error LNK2001: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const gloox::GLOOX_VERSION" (?GLOOX_VERSION@gloox@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B

    解决方法:

    参考http://camaya.net/glooxlist/dev/msg00125.html,

    关键在GLOOX_API这个宏的解释上,

    在C++ console的Project configuration properties\ c/c++ \Preprocesser\Preprcessor Definitions中加入GLOOX_IMPORTS 或 DLL_IMPORT 使extern 变量声明为 __declspec( dllimport );这样exe程序才认为这是个要从外部导入的变量。

    否则不会去外部(dll)中找,自然就说无法解析即找不到了。

    帮助别人就是提高自己

  • 相关阅读:
    告别08
    WinForm程序如何将子窗体嵌入到父窗体的Panel里
    几种排序算法
    接口的特征
    什么是重写
    C#异常处理
    什么是重载
    结构和类的区别
    Javascript的函数
    在ASP.NET中防止注入攻击
  • 原文地址:https://www.cnblogs.com/lugesot/p/1907219.html
Copyright © 2011-2022 走看看