【问题标题】:libtool: undefined symbols not allowed in i686-pc-mingw32 sharedlibtool:i686-pc-mingw32 共享中不允许未定义的符号
【发布时间】:2013-07-03 11:57:32
【问题描述】:

我正在使用 autotools 作为我的库的构建系统。最近库被移植到 Windows。尽管我遇到了一个奇怪的错误,但库编译和链接成功。 configure 和 make 后只有静态库。除了来自libtool 的警告之外,一切看起来都不错:

libtool: undefined symbols not allowed in i686-pc-mingw32 shared

我已经通过这段代码导出了 Windows 机器的所有符号:

#ifdef _WIN32
#    ifdef DLL_EXPORT
#        define LIBRARY_API __declspec(dllexport)
#    else
#        define LIBRARY_API __declspec(dllimport)
#    endif
#endif
#ifndef _WIN32
#    define LIBRARY_API
#endif

在我的每一个定义中:

class LIBRARY_API myClass {
// ...

注意事项
操作系统:Windows 8 x86_64
编译器套件:MinGW x86_64、MSYS x86

【问题讨论】:

    标签: c++ mingw libtool mingw-w64


    【解决方案1】:

    在您的 configure.ac 中,确保您的 libtool 初始化如下所示:

    LT_INIT([win32-dll])
    

    另外,您需要将-no-undefined 标志传递给Makefile.am 中的libtool。此标志禁用您收到的警告:

    libexample_la_LDFLAGS = -no-undefined
    

    更多详情请查看LT_INIT documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-16
      • 2011-02-28
      • 2021-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-14
      相关资源
      最近更新 更多