简体   繁体   中英

Not able to compile C++ using cygwin

New to C++ so I'm confused.

Trying to compile a very simple hello world using netbeans and cygwin, and I get this error.

Edit: Also tried from cygwin and got the same error.

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

What am I missing? I did a complete install of cygwin.

Thanks

Did you try compiling from the Cygwin shell ?

cat >hello.c <<EOF
#include <stdio.h>
void main()
{
        printf("Hello World !!!\n");
}
EOF
gcc -v hello.c

If it works, it's probably a problem with your Netbeans configuration. Especially, you could compare it to the LIBRARY_PATH you have in the gcc logs from the console.

I had to install w32api-runtime (which pulled w32api-headers too) to make cygwin 64 proceed with ./configure.

Prior to that, I had to manually install mpfr and mpc - gcc-core-5.2.1 d oesn't have these as dependencies somehow, despite it seems to be linked with them, and as a result it refuses to work, crying about missing cygmpfr-4.dll and cygmpc-3.dll . This clearly seems like maintainer/packager lack of care - this latter problem is known for at least four years now...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM