Message during linking
Thu Mar 19 14:49:00 GMT 2009
Eric Lilja wrote:
> g++ command_line.o grep.o scanner.o -s -o my_grep.exe
> Info: resolving typeinfo for std::runtime_error by linking to
> __imp___ZTISt13runtime_error (auto-import)
> Info: resolving std::cout by linking to __imp___ZSt4cout (auto-import)
> Info: resolving std::cerr by linking to __imp___ZSt4cerr (auto-import)
> warning: auto-importing has been activated without --enable-auto-import
> specified on the command line.
> This should work unless it involves constant data structures referencing
> symbols from auto-imported DLLs.
> What does this mean? Is it a problem?
What it means is that ld has not been informed in advance that it needs to
assume any undefined symbols in the executable may need to be imported from a
dll. Normally it is necessary to modify the source code to add a dllimport
declspec/attribute to the declarations of any functions that must be imported.
This feature of ld saves having to modify generic Linux source code with
This usually works, but in some circumstances it will fail, depending on
whether certain language constructs involving const data items exist in the code.
> Why did it happen?
It has started to happen now because libstdc++ is a DLL for the first time.
We've fixed upstream ld to enable the feature by default and these warnings
will disappear in the next binutils release.
> What do I do to fix it? Should I be using some flags now that I didn't even
The message gives you a clue; since the problem is that " [ ... something
has happened ...] without --enable-auto-import specified on the command line",
you need to specify --enable-auto-import on the command line. I agree it's
over-wordy and confusing, but it's trying to describe a complicated situation.
> An executable is generated btw, even if I use -Werror during
> linking (but maybe that doesn't have any effect).
I expect that -Werror only relates to compiler warnings.
> Here's the very simple Makefile that was used:
> CXX = g++
> CXXFLAGS = -Wall -Wextra -std=c++98 -pedantic -Werror -c
> LDFLAGS = -s -o $(EXEC)
Add -Wl,--enable-auto-import to those LDFLAGS.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
More information about the Cygwin