[英]How to change to use the g++ mingw toolchain under cygwin
It looks like g++/gcc-mingw is installed but I can't tell how to use it. 看起来已经安装了g ++ / gcc-mingw,但我不知道如何使用它。
I am building a C source file with a windows main proc and I get this error: 我正在使用Windows main proc构建C源文件,但出现此错误:
g++-3 -mwindows -L/usr/lib/gcc/i686-pc-mingw32 -lmingw32 winmain.c
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
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:找不到-lmingw32 collect2:ld返回1退出状态
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
$ g ++-3 -mwindows -L / usr / lib / gcc / i686-pc-mingw32 winmain.c /tmp/ccyLGxkn.o:winmain.c:(.text+0x21):未定义引用`MainWndProc(HWND __ *, @ 16'collect2:ld返回1退出状态
If I do a list directory on the installed libraries I see this: 如果在已安装的库上执行列表目录,则会看到以下内容:
$ ls /usr/lib/gcc/ i686-pc-cygwin/ i686-pc-mingw32/
$ ls / usr / lib / gcc / i686-pc-cygwin / i686-pc-mingw32 /
Note: 'i686-pc-mingw32' How do I compile using the mingw32 libraries? 注意:'i686-pc-mingw32'如何使用mingw32库进行编译?
Also, I installed the package: 'gcc-mingw-g++' through the cygwin setup.exe utility, I just don't know how to use it? 另外,我通过cygwin setup.exe实用程序安装了软件包“ gcc-mingw-g ++”,我只是不知道如何使用它?
Note: I am mostly working with 'cygwin', I would prefer NOT to install the full ming install? 注意:我主要使用'cygwin',我不希望不安装完整的ming install?
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++ 这些库是:gcc-mingw-g ++
mingw64-i686-gcc is the toolchain mingw64-i686-gcc是工具链
I ran with this command and it worked correctly: 我运行了此命令,它正常工作:
i686-pc-mingw32-g++
i686-pc-mingw32-g ++
i686-w64-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
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.