libtool:共享的i686-pc-mingw32中不允许使用未定义的符号 [英] libtool: undefined symbols not allowed in i686-pc-mingw32 shared

查看:341
本文介绍了libtool:共享的i686-pc-mingw32中不允许使用未定义的符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用自动工具作为我的图书馆的构建系统.最近,库已移植到Windows.我遇到一个奇怪的错误,但库编译和链接成功.配置和制作后只有静态库.除了libtool:

I'm using autotools as build system for a library of mine. Recently library is ported to Windows. Library compiles and links successfully though I encountered a strange error. There is only static libraries after configure and make. Evertything looks OK except a warning from libtool:

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

我已通过以下代码导出了Windows计算机的所有符号:

I have exported all symbols for Windows machines by this code:

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

在每个定义中,我都有:

And in every single definition I have:

class LIBRARY_API myClass {
// ...

注释:
操作系统:Windows 8 x86_64
编译器套件:MinGW x86_64,MSYS x86

Notes:
Operating System: Windows 8 x86_64
Compiler suite: MinGW x86_64, MSYS x86

推荐答案

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

In your configure.ac, make sure your libtool initialization looks like:

LT_INIT([win32-dll])

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

Also, you need to pass -no-undefined flag to libtool in your Makefile.am. This flag disables the warning you are getting:

libexample_la_LDFLAGS = -no-undefined

有关更多详细信息,请参见 LT_INIT文档.

More details about this in the LT_INIT documentation.

这篇关于libtool:共享的i686-pc-mingw32中不允许使用未定义的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆