fltk 在 windows 上抱怨 gcc
fltk complains about gcc on windows
我几乎一直在尝试以多种不同的方式在 windows 上构建 fltk
,但我总是以:
configure: error: C compiler cannot create executable
(msys fltk/configure)
或
Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
(CMake-gui)
我用 fltk 1.3.0
和 1.3.3
试过了,我什至用过三个不同的 MinGW 发行版,GCC
版本:5.1.0
; 4.9.2
和 3.4.5
。然而它就是不会编译。这是 ./configure 文件生成的一些错误日志:
$ ./configure --prefix=C:/libs/fltk-1.3.3
-----------
Core tests.
-----------
configure:1336: checking build system type configure:1354: result:
i686-pc-mingw32 configure:1362: checking host system type
configure:1376: result: i686-pc-mingw32 configure:1439: checking for
gcc configure:1455: found /c/mingw32/bin/gcc configure:1465: result:
gcc configure:1709: checking for C compiler version configure:1712:
gcc --version &5 gcc.exe (i686-win32-dwarf-rev2, Built by
MinGW-W64 project) 4.9.2 Copyright (C) 2014 Free Software Foundation,
Inc. This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
configure:1715: $? = 0 configure:1717: gcc -v &5 Using
built-in specs. COLLECT_GCC=c:\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw32/bin/../libexec/gcc/i686-w64-mingw32/4.9.2/lto-wrapper.exe
Target: i686-w64-mingw32 Configured with:
../../../src/gcc-4.9.2/configure --host=i686-w64-mingw32
--build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32 --with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-cloog=/c/mingw492/prerequisites/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='i686-win32-dwarf-rev2, Built by MinGW-W64 project'
--with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32/opt/include -I/c/mingw492/prerequisites/i686-zlib-static/include -I/c/mingw492/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe
-I/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32/opt/include -I/c/mingw492/prerequisites/i686-zlib-static/include -I/c/mingw492/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe
-L/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32/opt/lib -L/c/mingw492/prerequisites/i686-zlib-static/lib -L/c/mingw492/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware' Thread model: win32 gcc version 4.9.2 (i686-win32-dwarf-rev2, Built by MinGW-W64 project) configure:1720:
$? = 0 configure:1722: gcc -V &5 gcc.exe: error:
unrecognized command line option '-V' gcc.exe: fatal error: no input
files compilation terminated. configure:1725: $? = 1 configure:1748:
checking for C compiler default output configure:1751: gcc
conftest.c >&5
c:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x39):
undefined reference to `WinMain@16' collect2.exe: error: ld returned 1
exit status configure:1754: $? = 1 configure: failed program was: |
line 1728 "configure" | /* confdefs.h. */ | | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define
PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | /* end confdefs.h.
*/ | | int main () | { | | ; | return 0; | } configure:1793: error: C compiler cannot create executables See `config.log' for more
details.
configure: exit 77
我之前使用这些相同的工具(nana 和 SFML)编译了另外 2 个 gui 库,所以 gcc 编译器不会有任何问题。
编辑
有些东西(很可能是 cygwin
)一直在破坏我的 mingw
gcc
程序,每次它 "broken" 我都会变黑 vcc1.exe windows.然后我必须替换 mingw 文件夹以使其再次工作,这主要发生在我打开 netbeans 时。我只是不知道如何解决这个问题,所以我一直在避免 cygwin
和 netbeans
.
- 昨天我终于能够使用此版本的 TDM-GCC 构建它(根据 gui 安装程序):
- MinGW-w64/TDM64(32 位和 64 位)==> TDM-GCC
我用 cmake gui 而不是 .configure
1。打开 cmake 图形用户界面。
2。输入源代码文件夹(fltk文件夹的根目录,即:"C:/libs/fltk-1.3.3")。
3. 输入构建文件夹,即:"C:/libs/fltk-1.3.3/build/"。
4. 单击配置
5. ** 您可以选择更改一些选项,但我没有
6. 单击 Genertae
7. 在 cmd 中(我使用git bash 虽然):cd 到构建目录和 运行 make 或 mingw32-make
我完全卸载了 cygwin,因为它会干扰工具链构建,即 mingw 和 tdm-gcc(仍然不确定为什么会这样)。
设置开发环境的更简单方法是使用 MSYS2。
- 下载并安装
- 运行 MSYS2 Shell
- 安装一些开发工具和 FLTK:
pacman -S make automake autoconf libtool mingw-w64-i686-gcc mingw-w64-i686-fltk
- 运行 Mingw64 Shell 并且您将能够轻松编译您的源代码:
g++ -o myproject myproject.cpp -lfltk
我几乎一直在尝试以多种不同的方式在 windows 上构建 fltk
,但我总是以:
configure: error: C compiler cannot create executable (msys fltk/configure)
或
Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken (CMake-gui)
我用 fltk 1.3.0
和 1.3.3
试过了,我什至用过三个不同的 MinGW 发行版,GCC
版本:5.1.0
; 4.9.2
和 3.4.5
。然而它就是不会编译。这是 ./configure 文件生成的一些错误日志:
$ ./configure --prefix=C:/libs/fltk-1.3.3
-----------
Core tests.
-----------
configure:1336: checking build system type configure:1354: result: i686-pc-mingw32 configure:1362: checking host system type configure:1376: result: i686-pc-mingw32 configure:1439: checking for gcc configure:1455: found /c/mingw32/bin/gcc configure:1465: result: gcc configure:1709: checking for C compiler version configure:1712: gcc --version &5 gcc.exe (i686-win32-dwarf-rev2, Built by MinGW-W64 project) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:1715: $? = 0 configure:1717: gcc -v &5 Using built-in specs. COLLECT_GCC=c:\mingw32\bin\gcc.exe COLLECT_LTO_WRAPPER=c:/mingw32/bin/../libexec/gcc/i686-w64-mingw32/4.9.2/lto-wrapper.exe Target: i686-w64-mingw32 Configured with: ../../../src/gcc-4.9.2/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32 --with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-cloog=/c/mingw492/prerequisites/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='i686-win32-dwarf-rev2, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32/opt/include -I/c/mingw492/prerequisites/i686-zlib-static/include -I/c/mingw492/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32/opt/include -I/c/mingw492/prerequisites/i686-zlib-static/include -I/c/mingw492/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32/opt/lib -L/c/mingw492/prerequisites/i686-zlib-static/lib -L/c/mingw492/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware' Thread model: win32 gcc version 4.9.2 (i686-win32-dwarf-rev2, Built by MinGW-W64 project) configure:1720: $? = 0 configure:1722: gcc -V &5 gcc.exe: error: unrecognized command line option '-V' gcc.exe: fatal error: no input files compilation terminated. configure:1725: $? = 1 configure:1748: checking for C compiler default output configure:1751: gcc
conftest.c >&5 c:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x39): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status configure:1754: $? = 1 configure: failed program was: |line 1728 "configure" | /* confdefs.h. */ | | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define
PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | /* end confdefs.h. */ | | int main () | { | | ; | return 0; | } configure:1793: error: C compiler cannot create executables See `config.log' for more details.
configure: exit 77
我之前使用这些相同的工具(nana 和 SFML)编译了另外 2 个 gui 库,所以 gcc 编译器不会有任何问题。
编辑
有些东西(很可能是 cygwin
)一直在破坏我的 mingw
gcc
程序,每次它 "broken" 我都会变黑 vcc1.exe windows.然后我必须替换 mingw 文件夹以使其再次工作,这主要发生在我打开 netbeans 时。我只是不知道如何解决这个问题,所以我一直在避免 cygwin
和 netbeans
.
- 昨天我终于能够使用此版本的 TDM-GCC 构建它(根据 gui 安装程序):
- MinGW-w64/TDM64(32 位和 64 位)==> TDM-GCC
- MinGW-w64/TDM64(32 位和 64 位)==> TDM-GCC
我用 cmake gui 而不是 .configure
1。打开 cmake 图形用户界面。
2。输入源代码文件夹(fltk文件夹的根目录,即:"C:/libs/fltk-1.3.3")。
3. 输入构建文件夹,即:"C:/libs/fltk-1.3.3/build/"。
4. 单击配置
5. ** 您可以选择更改一些选项,但我没有
6. 单击 Genertae
7. 在 cmd 中(我使用git bash 虽然):cd 到构建目录和 运行 make 或 mingw32-make我完全卸载了 cygwin,因为它会干扰工具链构建,即 mingw 和 tdm-gcc(仍然不确定为什么会这样)。
设置开发环境的更简单方法是使用 MSYS2。
- 下载并安装
- 运行 MSYS2 Shell
- 安装一些开发工具和 FLTK:
pacman -S make automake autoconf libtool mingw-w64-i686-gcc mingw-w64-i686-fltk
- 运行 Mingw64 Shell 并且您将能够轻松编译您的源代码:
g++ -o myproject myproject.cpp -lfltk