How to handle warning: `LT_SCOPE' redefined on mingw32?

Christian Stimming stimming at
Tue Aug 29 06:26:41 EDT 2006

Hash: SHA1

I'm compiling a DLL (say foo.dll) on Windows/mingw32 that links to the
ltdl-DLL as well. To get automake-1.9.6 and libtool-1.5.22 to create my
foo.dll as DLL, I specify the LDFLAGS="-no-undefined". One of the things
that will happen because of this is that libtool adds -DDLL_EXPORT to
the compiler command line. But because I use the libtool dll, I also
need to define LIBLTDL_DLL_IMPORT as otherwise I don't import libtool's
function and variables properly and get a bunch of linker errors.

Here's the deal: If I have both DLL_EXPORT and LIBLTDL_DLL_IMPORT
defined when including <ltdl.h>, I get

  In file included from foo.c:1:
  /usr/local/mingw/include/ltdl.h:134: warning: `LT_SCOPE' redefined
  /usr/local/mingw/include/ltdl.h:131: warning: this is the location of
the previous definition

This will stop every build that wants to compile with -Werror enabled.
And for my DLL, there is absolutely no way around it to avoid this
warning. What is your proposed way to avoid this warning?

The documentation doesn't say anything about DLL_EXPORT or LT_SCOPE or

Funny enough this has already been discussed in 2001 [1] but the problem
with the created warning still persists in libtool-1.5.22 and obviously
even in the most recent CVS version [2]. As for an actual resolution, I
can imagine several of them and none of them is particularly difficult.
IMHO it's just a matter of properly distinguishing whether the
dllexport/import are used when compiling libtool itself, compared to
compiling some external application/software.

Is everyone simply ignoring the warning and effectively never compiling
with -Werror?

Christian Stimming

(by way of the GnuCash porting to Windows)

Version: GnuPG v1.4.2.1 (MingW32)
Comment: Using GnuPG with Mozilla -


More information about the gnucash-devel mailing list