This bug brings up a point that I've been wanting to ask here for a while.  Since WINVER=0x0400 has waned to the point of near non-existence should we not begin to default to 0x0500?  Those wanting to support older versions can modify it just like those wanting to support newer versions.


---------- Forwarded message ----------
From: SF/projects/mingw notification list <>
Date: Sun, Jan 1, 2012 at 11:10 AM
Subject: [MinGW-notify] [ mingw-Bugs-3447223 ] compiler not imports function from lib
To: "" <>

This list is used to send updates of submitted patches, bug reports and file releases.  You are discouraged from posting to this list.  If you wish to unsubscribe you can do so at
Bugs item #3447223, was opened at 2011-12-01 08:18
Message generated for change (Comment added) made by keithmarshall
You can respond by visiting:

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: w32api
Group: None
>Status: Pending
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: splitfrog (splitfrog)
Assigned to: Nobody/Anonymous (nobody)
Summary: compiler not imports function from lib

Initial Comment:
A compiler not imports a function GetShellWindow(), that located in libuser32.a library (user32.dll) . Compiler writes message:

main.cpp: In function 'int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)':
main.cpp:10:17: error: 'GetShellWindow' was not declared in this scope

Tested on gcc ver. 4.4.0, 4.5.2, 4.6.1-2. Other functions from libuser32.a are imports fine.
My info:

GCC Version:
Using built-in specs.
COLLECT_GCC=C:\Program Files\MinGw_gcc.4.6.1-2\bin\gcc.EXE
COLLECT_LTO_WRAPPER=c:/program files/mingw_gcc.4.6.1-2/bin/../libexec/gcc/mingw32/4.6.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.6.1/configure --enable-languages=c,c++,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --
enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --build=
mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.6.1 (GCC)

Binutils Version:
GNU ld (GNU Binutils)

MS Windows 2003 Enterprise SP2 x86.  (Also tested on Windows 7 x86)


>Comment By: Keith Marshall (keithmarshall)
Date: 2012-01-01 08:10

This is more likely to be your error, than a MinGW bug.  I'm guessing,
because I can't read your code example, (unsuitable archive format --
please use tar.gz or zip), that you haven't enabled the necessary level of
WINVER support; see the notes in include/windef.h

BTW, "foo not defined in this scope" doesn't mean the symbol wasn't
imported from the DLL; it means that you either didn't include a necessary
header, or you didn't enable appropriate support to expose a conditional
declaration in a header you did include. The declaration of
GetShellWindow() is provided conditionally when you include windows.h, but
it will not be exposed if you neglect to define _WIN32_WINNT >= 0x0500


You can respond by visiting:

Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free!
MinGW-notify mailing list