Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1606 compiler not imports function from lib

No_User_Response
closed-invalid
nobody
2012-10-19
2011-12-01
splitfrog
No

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) 2.21.53.20110804

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

Discussion

  • splitfrog
    splitfrog
    2011-12-01

    code sample

     
    Attachments
  • Keith Marshall
    Keith Marshall
    2012-01-01

    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 beforehand.

     
  • Keith Marshall
    Keith Marshall
    2012-01-01

    • status: open --> pending-invalid
     
  • Earnie Boyd
    Earnie Boyd
    2012-10-19

    • milestone: --> No_User_Response
    • status: pending-invalid --> closed-invalid