fltk在windows上抱怨gcc

时间:2020-12-18 06:59:08

I've been trying for almost a to build fltk on windows in so many different ways but I always end up with:

我一直在尝试几乎以一种不同的方式在windows上构建fltk,但我总是最终得到:

configure: error: C compiler cannot create executable (msys fltk/configure)

configure:错误:C编译器无法创建可执行文件(msys fltk / configure)

or

Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken (CMake-gui)

检查工作C编译器:C:/MinGW/bin/gcc.exe - 破解(CMake-gui)

I've tried it with fltk 1.3.0 and 1.3.3 and I've even used three different MinGW distros, GCC version: 5.1.0; 4.9.2 and 3.4.5. Yet it just won't compile. Here is some of the error log generated by the ./configure file:

我用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

$ ./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:1336:检查构建系统类型configure:1354:result:i686-pc-mingw32 configure:1362:检查主机系统类型configure:1376:result:i686-pc-mingw32 configure:1439:检查gcc configure:1455:found / c / mingw32 / bin / gcc configure:1465:结果:gcc configure:1709:检查C编译器版本configure:1712:gcc --version&5 gcc.exe(i686-win32-dwarf-rev2,由MinGW-W64构建项目)4.9.2版权所有(C)2014 Free Software Foundation,Inc。这是免费软件;查看复制条件的来源。没有保修;甚至不适用于适销性或特定用途的适用性。

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: |

配置:1715:$? = 0 configure:1717:gcc -v&5使用内置规范。 COLLECT_GCC = c:\ mingw32 \ bin \ gcc.exe COLLECT_LTO_WRAPPER = c:/ mingw32 / bin /../ libexec / gcc / i686-w64-mingw32 / 4.9.2 / lto-wrapper.exe目标:i686-w64-mingw32配置:../../../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 --wit h-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,由MinGW-W64项目建造'--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-49 2-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, - 大地址感知'线程模型:win32 gcc版本4.9.2(i686-win32-dwarf-rev2,由MinGW-W64项目构建)配置:1720:$? = 0 configure:1722:gcc -V&5​​ gcc.exe:错误:无法识别的命令行选项'-V'gcc.exe:致命错误:没有输入文件编译终止。配置:1725:$? = 1 configure:1748:检查C编译器默认输出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):对WinMain的未定义引用@ 16'cols2.exe:错误:ld返回1退出状态configure:1754:$? = 1 configure:失败的程序是:|

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.

PACKAGE_STRING“”| #define PACKAGE_BUGREPORT“”| / *结束confdefs.h。 * / | | int main()| {| | ; |返回0; |配置:1793:错误:C编译器无法创建可执行文件有关详细信息,请参阅`config.log'。

configure: exit 77

configure:退出77

I previously compiled 2 other gui libraries with these same tools (nana and SFML), so there can't be anything wrong with the gcc compilers.

我以前使用这些相同的工具(nana和SFML)编译了2个其他gui库,因此gcc编译器没有任何问题。

EDIT

Something (most probably cygwin) keeps breaking my mingw gcc program and every time its "broken" I get black vcc1.exe windows. Then I must replace the mingw folder to get it working again, this happens mostly when I open netbeans. I just don't know how to fix this, so I've just been avoiding cygwin and netbeans.

东西(很可能是cygwin)一直在破坏我的mingw gcc程序,每次“破碎”我都会得到黑色的vcc1.exe窗口。然后我必须更换mingw文件夹以使其再次运行,这主要发生在我打开netbeans时。我只是不知道如何解决这个问题,所以我一直在避免使用cygwin和netbeans。

2 个解决方案

#1


  • I was finally able to build it yesterday with this version of TDM-GCC (as per the gui installer):
    • MinGW-w64/TDM64 (32-bit and 64-bit) ==> TDM-GCC
    • MinGW-w64 / TDM64(32位和64位)==> TDM-GCC

  • 我终于能够使用这个版本的TDM-GCC构建它(根据gui安装程序):MinGW-w64 / TDM64(32位和64位)==> TDM-GCC

  • I used he cmake gui instead of the .configure
    1. open cmake gui.
    2. input the source code folder (root of fltk folder, ie: "C:/libs/fltk-1.3.3").
    3. input the build folder, ie: "C:/libs/fltk-1.3.3/build/".
    4. click configure
    5. ** optionally you can change some options but i didn't
    6. click Genertae
    7. in cmd (I used git bash though): cd to the build directory and run make or mingw32-make

    我用cmake gui而不是.configure 1.打开cmake gui。 2.输入源代码文件夹(fltk文件夹的根目录,即:“C:/libs/fltk-1.3.3”)。 3.输入构建文件夹,即:“C:/libs/fltk-1.3.3/build/”。 4.单击配置5. **可选您可以更改一些选项,但我没有6.单击Genertae 7. in cmd(我使用git bash):cd到build目录并运行make或mingw32-make

  • I completely uninstalled cygwin because of its interference with the tool chain builds, i.e mingw and tdm-gcc (Still not sure why this happens).

    我完全卸载了cygwin,因为它干扰了工具链的构建,即mingw和tdm-gcc(仍然不确定为什么会发生这种情况)。

#2


An easier way to setup a development environment is to use MSYS2.

设置开发环境的更简单方法是使用MSYS2。

  • Download and install
  • 下载并安装

  • Run MSYS2 Shell
  • 运行MSYS2 Shell

  • Install some dev tools anf FLTK: pacman -S make automake autoconf libtool mingw-w64-i686-gcc mingw-w64-i686-fltk
  • 安装一些开发工具和FLTK:pacman -S make automake autoconf libtool mingw-w64-i686-gcc mingw-w64-i686-fltk

  • Run Mingw64 Shell and you'll be able to easily compile your source: g++ -o myproject myproject.cpp -lfltk
  • 运行Mingw64 Shell,您将能够轻松编译源代码:g ++ -o myproject myproject.cpp -lfltk

#1


  • I was finally able to build it yesterday with this version of TDM-GCC (as per the gui installer):
    • MinGW-w64/TDM64 (32-bit and 64-bit) ==> TDM-GCC
    • MinGW-w64 / TDM64(32位和64位)==> TDM-GCC

  • 我终于能够使用这个版本的TDM-GCC构建它(根据gui安装程序):MinGW-w64 / TDM64(32位和64位)==> TDM-GCC

  • I used he cmake gui instead of the .configure
    1. open cmake gui.
    2. input the source code folder (root of fltk folder, ie: "C:/libs/fltk-1.3.3").
    3. input the build folder, ie: "C:/libs/fltk-1.3.3/build/".
    4. click configure
    5. ** optionally you can change some options but i didn't
    6. click Genertae
    7. in cmd (I used git bash though): cd to the build directory and run make or mingw32-make

    我用cmake gui而不是.configure 1.打开cmake gui。 2.输入源代码文件夹(fltk文件夹的根目录,即:“C:/libs/fltk-1.3.3”)。 3.输入构建文件夹,即:“C:/libs/fltk-1.3.3/build/”。 4.单击配置5. **可选您可以更改一些选项,但我没有6.单击Genertae 7. in cmd(我使用git bash):cd到build目录并运行make或mingw32-make

  • I completely uninstalled cygwin because of its interference with the tool chain builds, i.e mingw and tdm-gcc (Still not sure why this happens).

    我完全卸载了cygwin,因为它干扰了工具链的构建,即mingw和tdm-gcc(仍然不确定为什么会发生这种情况)。

#2


An easier way to setup a development environment is to use MSYS2.

设置开发环境的更简单方法是使用MSYS2。

  • Download and install
  • 下载并安装

  • Run MSYS2 Shell
  • 运行MSYS2 Shell

  • Install some dev tools anf FLTK: pacman -S make automake autoconf libtool mingw-w64-i686-gcc mingw-w64-i686-fltk
  • 安装一些开发工具和FLTK:pacman -S make automake autoconf libtool mingw-w64-i686-gcc mingw-w64-i686-fltk

  • Run Mingw64 Shell and you'll be able to easily compile your source: g++ -o myproject myproject.cpp -lfltk
  • 运行Mingw64 Shell,您将能够轻松编译源代码:g ++ -o myproject myproject.cpp -lfltk