Libtool: undefined characters not allowed in i686-pc-mingw32 together

I use autotools as a build system for my library. The library has recently been ported to Windows. The library successfully compiles and links, although I found a strange error. After configuration and creation, there are only static libraries. Evertything looks fine, except for a warning from libtool :

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

I exported all the characters 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 { // ... 

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

+4
source share
1 answer

In configure.ac verify that the libtool initialization looks like this:

 LT_INIT([win32-dll]) 

In addition, you need to pass the -no-undefined flag to libtool in Makefile.am . This flag disables the warning you receive:

 libexample_la_LDFLAGS = -no-undefined 

See the LT_INIT documentation for more details .

+11
source

Source: https://habr.com/ru/post/1489890/


All Articles