2013-07-05 67 views
4

我正在使用autotools作爲我的庫的構建系統。最近庫被移植到Windows。圖書館編譯和鏈接成功,雖然我遇到了一個奇怪的錯誤。配置和製作後只有靜態庫。 Evertything看起來不錯,除了從libtool警告:libtool:未定義符號不允許t in i686-pc-mingw32共享

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 { 
// ... 

筆記
Opera婷系統:Windows 8的x86_64的
編譯器套件:MinGW的x86_64的,MSYS 86

回答

10

在你configure.ac,請確保您的libtool初始化是這樣的:

LT_INIT([win32-dll]) 

此外,您還需要通過-no-undefined標誌到您的Makefile.am的libtool。此標誌禁用你所得到的警告:在LT_INIT documentation這個

libexample_la_LDFLAGS = -no-undefined 

更多細節。