1
votes

It looks like g++/gcc-mingw is installed but I can't tell how to use it.

I am building a C source file with a windows main proc and I get this error:

g++-3 -mwindows -L/usr/lib/gcc/i686-pc-mingw32 -lmingw32 winmain.c

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lmingw32 collect2: ld returned 1 exit status

Or

$ g++-3 -mwindows -L/usr/lib/gcc/i686-pc-mingw32 winmain.c /tmp/ccyLGxkn.o:winmain.c:(.text+0x21): undefined reference to `MainWndProc(HWND__*, unsigned int, unsigned int, long)@16' collect2: ld returned 1 exit status

If I do a list directory on the installed libraries I see this:

$ ls /usr/lib/gcc/ i686-pc-cygwin/ i686-pc-mingw32/

Note: 'i686-pc-mingw32' How do I compile using the mingw32 libraries?

Also, I installed the package: 'gcc-mingw-g++' through the cygwin setup.exe utility, I just don't know how to use it?

Note: I am mostly working with 'cygwin', I would prefer NOT to install the full ming install?

1
Are you attempting to use this through the Cygwin prompt or windows CMD?Rivasa
This is through the Cygwin promptBerlin Brown

1 Answers

0
votes

There are actually two sets of projects, the libraries and the actually toolchain. I installed the libraries and not the toolchain.

The libraries are: gcc-mingw-g++

mingw64-i686-gcc is the toolchain

I ran with this command and it worked correctly:

i686-pc-mingw32-g++

i686-w64-mingw32-g++

Or:

i686-w64-mingw32-g++ -mwindows -static -I/opt/jdk/include -I/opt/jdk/include/win32 -Wl,--add-stdcall-alias -shared -o Hello.dll Hello.cpp