gcc cygwin compile error

11,142

Apparently, you are using MingW features (user32 is a Microsoft library, not a POSIX one). So you should install the MingW packages. Here is a list; I doubt you need all of them, though (the exact set will depend on the application you are trying to build).

Share:
11,142
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    what are the minimum packages to work with gcc under cygwin? I have installed gcc-core, gcc-g++, gdb, binutils, make. are these not sufficient? when I try to compile a basic c code I get following error

    /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find
     -luser32
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find
     -lkernel32
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find
     -ladvapi32
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find
     -lshell32
    

    there are dll files named user32 advapi shell32 in system32. does the linker search for them but not find? is it a path related issue? when I go $PATH

    $ $PATH
    bash: /usr/local/bin:/usr/bin:/bin:/cygdrive/c/Program: No such file or directory
    

    and echo $PATH

    $ echo $PATH
    /usr/local/bin:/usr/bin:/bin:/cygdrive/c/Program Files/PC Connectivity Solution/
    :/cygdrive/c/Program Files/MiKTeX 2.8/miktex/bin:/cygdrive/c/WINDOWS/system32:/c
    ygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/Program Files/AT
    I Technologies/ATI.ACE/Core-Static:/cygdrive/c/Program Files/MATLAB/R2010a/runti
    me/win32:/cygdrive/c/Program Files/MATLAB/R2010a/bin:/cygdrive/c/Program Files/S
    amsung/Samsung PC Studio 3/:/cygdrive/c/Cygwin/bin:/cygdrive/c/Cygwin/usr/bin
    
  • thoni56
    thoni56 over 11 years
    You shouldn't do that I think. They are put in separate directories for a reason. Use compile and link-time arguments and options to get it right. If you are building with mingw features you either should use -mno-cygwin (pre-gcc4) or a mingw cross compiler (which is available in the cygwin installer 'setup.exe').
  • Viacheslav Shalamov
    Viacheslav Shalamov almost 7 years
    Unfortunately, your link is broken and site cablelabs.com does not have sub-domain devzone (at least, for public access). Can you fix it?