用MinGW编译opencv时出错解决办法:(gcc 7.1.0 and cmake 3.9.0)->出错提示: windres.exe: unknown option -- W

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_42005205/article/details/81000017

环境Windows 7 x64

按照网上的教程安装qt和opencv的过程中,对opencv-3.4.0源码进行编译时,出现如下错误

 

> make
[  2%] Built target zlib
[  5%] Built target libtiff
[  8%] Built target libjpeg
[ 16%] Built target libwebp
[ 19%] Built target libjasper
[ 20%] Built target libpng
[ 25%] Built target IlmImf
[ 31%] Built target libprotobuf
[ 32%] Built target opencv_core_pch_dephelp
[ 32%] Built target pch_Generate_opencv_core
[ 32%] Building RC object modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj
v:\MinGW-Builds\mingw64\bin\windres.exe: unknown option -- W
Usage: v:\MinGW-Builds\mingw64\bin\windres.exe [option(s)] [input-file] [output-file]
 The options are:
  -i --input=<file>            Name input file
  -o --output=<file>           Name output file
  -J --input-format=<format>   Specify input format
  -O --output-format=<format>  Specify output format
  -F --target=<target>         Specify COFF target
     --preprocessor=<program>  Program to use to preprocess rc file
     --preprocessor-arg=<arg>  Additional preprocessor argument
  -I --include-dir=<dir>       Include directory when preprocessing rc file
  -D --define <sym>[=<val>]    Define SYM when preprocessing rc file
  -U --undefine <sym>          Undefine SYM when preprocessing rc file
  -v --verbose                 Verbose - tells you what it's doing
  -c --codepage=<codepage>     Specify default codepage
  -l --language=<val>          Set language when reading rc file
     --use-temp-file           Use a temporary file instead of popen to read
                               the preprocessor output
     --no-use-temp-file        Use popen (default)
  -r                           Ignored for compatibility with rc
  @<file>                      Read options from <file>
  -h --help                    Print this help message
  -V --version                 Print version information
FORMAT is one of rc, res, or coff, and is deduced from the file name
extension if not specified.  A single file name is an input file.
No input-file is stdin, default rc.  No output-file is stdout, default rc.
v:\MinGW-Builds\mingw64\bin\windres.exe: supported targets: pe-x86-64 pei-x86-64 pe-bigobj-x86-64 elf64-x86-64 elf64-l1om elf64-k1om pe-i386 pei-i386 elf32-i386 elf32-iamcu elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
modules/core/CMakeFiles/opencv_core.dir/build.make:1642: recipe for target `modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj' failed
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj] Error 1
CMakeFiles/Makefile2:1512: recipe for target `modules/core/CMakeFiles/opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:162: recipe for target `all' failed
make: *** [all] Error 2

 

解决办法:

1、本人参照的安装教程:https://blog.csdn.net/sinat_36264666/article/details/73200739,在第二部分:配置cmake的第5步:选中“WITH_OPENGL”、“WITH_QT”,将“WITH_IPP”取消。然后再次点【Configure】中,同时将ENABLE_PRECOMPILED_HEADERS”取消。

2、此时你根据教程配置到“第三部分:编译OPENCV”的第一步:执行mingw32-make命令时,会出现如下错误:在文件opencv/sources/modules/videoio/src/cap_dshow.cpp中出错 error : 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' was not declared in this scope ...。此时将cap_dshow.cpp文件打开,在#include "DShow.h"行的前面添加如下语句: #define NO_DSHOW_STRSAFE, before the line 。继续执行mingw32-make命令就可编译成功。

展开阅读全文

windows下mingw编译gcc出错 [求助]

03-08

$ makern[ -f stage_final ] || echo stage3 > stage_finalrnmake[1]: Entering directory `/gcc-4.6.2'rnmake[2]: Entering directory `/gcc-4.6.2'rnmake[3]: Entering directory `/gcc-4.6.2'rnrm -f stage_currentrnmake[3]: Leaving directory `/gcc-4.6.2'rnmake[2]: Leaving directory `/gcc-4.6.2'rnmake[2]: Entering directory `/gcc-4.6.2'rnmake[3]: Entering directory `/gcc-4.6.2/host-i686-pc-mingw32/libiberty'rnmake[4]: Entering directory `/gcc-4.6.2/host-i686-pc-mingw32/libiberty/testsuitern'rnmake[4]: Nothing to be done for `all'.rnmake[4]: Leaving directory `/gcc-4.6.2/host-i686-pc-mingw32/libiberty/testsuite'rnrnmake[3]: Leaving directory `/gcc-4.6.2/host-i686-pc-mingw32/libiberty'rnmake[3]: Entering directory `/gcc-4.6.2/host-i686-pc-mingw32/lto-plugin'rnmake all-amrnmake[4]: Entering directory `/gcc-4.6.2/host-i686-pc-mingw32/lto-plugin'rnmake[4]: Nothing to be done for `all-am'.rnmake[4]: Leaving directory `/gcc-4.6.2/host-i686-pc-mingw32/lto-plugin'rnmake[3]: Leaving directory `/gcc-4.6.2/host-i686-pc-mingw32/lto-plugin'rnmake[3]: Entering directory `/gcc-4.6.2/host-i686-pc-mingw32/intl'rnrm -f stamp-h1rn/bin/sh ./config.status config.hrnconfig.status: creating config.hrnconfig.status: config.h is unchangedrntest -f config.h || (rm -f stamp-h1 && make stamp-h1)rnmake[3]: Leaving directory `/gcc-4.6.2/host-i686-pc-mingw32/intl'rnmake[3]: Entering directory `/gcc-4.6.2/build-i686-pc-mingw32/libiberty'rnmake[4]: Entering directory `/gcc-4.6.2/build-i686-pc-mingw32/libiberty/testsuitrne'rnmake[4]: Nothing to be done for `all'.rnmake[4]: Leaving directory `/gcc-4.6.2/build-i686-pc-mingw32/libiberty/testsuitern'rnmake[3]: Leaving directory `/gcc-4.6.2/build-i686-pc-mingw32/libiberty'rnmake[3]: Entering directory `/gcc-4.6.2/build-i686-pc-mingw32/fixincludes'rnmake[3]: Nothing to be done for `all'.rnmake[3]: Leaving directory `/gcc-4.6.2/build-i686-pc-mingw32/fixincludes'rnmake[3]: Entering directory `/gcc-4.6.2/host-i686-pc-mingw32/zlib'rntrue "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CFLAGS=-g -fkeep-inline-functions" "CXXFLrnAGS=" "CFLAGS_FOR_BUILD=-g -O2" "CFLAGS_FOR_TARGET=-g -O2" "INSTALL=/bin/installrn -c" "INSTALL_DATA=/bin/install -c -m 644" "INSTALL_PROGRAM=/bin/install -c" "INrnSTALL_SCRIPT=/bin/install -c" "LDFLAGS=-Wl,--stack,12582912" "LIBCFLAGS=-g -O2 -rnD__USE_MINGW_ACCESS" "LIBCFLAGS_FOR_TARGET=-g -O2" "MAKE=make" "MAKEINFO=makeinfrno --split-size=5000000 --split-size=5000000 --split-size=5000000 " "PICFLAG=" "PrnICFLAG_FOR_TARGET=" "SHELL=/bin/sh" "EXPECT=expect" "RUNTEST=runtest" "RUNTESTFLrnAGS=" "exec_prefix=/usr/local" "infodir=/usr/local/share/info" "libdir=/usr/locarnl/lib" "prefix=/usr/local" "tooldir=/usr/local/i686-pc-mingw32" "AR=ar" "AS=as"rn"CC=gcc" "CXX=g++" "LD=e:/mingw32/bin/../lib/gcc/mingw32/4.5.0/../../../../mingwrn32/bin/ld.exe" "LIBCFLAGS=-g -O2 -D__USE_MINGW_ACCESS" "NM=nm" "PICFLAG=" "RANLIrnB=ranlib" "DESTDIR=" DO=all multi-do # makernmake[3]: Leaving directory `/gcc-4.6.2/host-i686-pc-mingw32/zlib'rnmake[3]: Entering directory `/gcc-4.6.2/host-i686-pc-mingw32/libcpp'rnmake[3]: Nothing to be done for `all'.rnmake[3]: Leaving directory `/gcc-4.6.2/host-i686-pc-mingw32/libcpp'rnmake[3]: Entering directory `/gcc-4.6.2/host-i686-pc-mingw32/libdecnumber'rnmake[3]: Nothing to be done for `all'.rnmake[3]: Leaving directory `/gcc-4.6.2/host-i686-pc-mingw32/libdecnumber'rnmake[3]: Entering directory `/gcc-4.6.2/host-i686-pc-mingw32/gcc'rnrm -rf include-fixed; mkdir include-fixedrnchmod a+rx include-fixedrnif [ -d ../prev-gcc ]; then \rn cd ../prev-gcc && \rn make real-install-headers-tar DESTDIR=`pwd`/../gcc/ \rn libsubdir=. ; \rn else \rn set -e; for ml in `cat fixinc_list`; do \rn sysroot_headers_suffix=`echo $ml | sed -e 's/;.*$//'`; \rn multi_dir=`echo $ml | sed -e 's/^[^;]*;//'`; \rn fix_dir=include-fixed$multi_dir; \rn if ! false && test ! -d `echo /mingw/include | sed -e :a -e 's,[^/]*rn/\.\.\/,,' -e ta`; then \rn echo The directory that should contain system headers does not exirnst: >&2 ; \rn echo " `echo /mingw/include | sed -e :a -e 's,[^/]*/\.\.\/,,' -ernta`" >&2 ; \rn tooldir_sysinc=`echo "/usr/local/lib/gcc/i686-pc-mingw32/4.6.2/../rn../../../i686-pc-mingw32/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`;rn\rn if test "x`echo /mingw/include | sed -e :a -e 's,[^/]*/\.\.\/,,' -rne ta`" = "x$tooldir_sysinc"; \rn then sleep 1; else exit 1; fi; \rn fi; \rn /bin/sh ../.././gcc/../mkinstalldirs $fix_dir; \rn chmod a+rx $fix_dir || true; \rn (TARGET_MACHINE='i686-pc-mingw32'; srcdir=`cd ../.././gcc; $PWDCMD-rnpwd`; \rn SHELL='/bin/sh'; MACRO_LIST=`$PWDCMD-pwd`/macro_list ; \rn gcc_dir=`$PWDCMD-pwd` ; \rn export TARGET_MACHINE srcdir SHELL MACRO_LIST && \rn cd ../../build-i686-pc-mingw32/fixincludes && \rn /bin/sh ./fixinc.sh "$gcc_dir/$fix_dir" \rn `echo /mingw/include | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` )rn; \rn rm -f $fix_dir/syslimits.h; \rn if [ -f $fix_dir/limits.h ]; then \rn mv $fix_dir/limits.h $fix_dir/syslimits.h; \rn else \rn cp ../.././gcc/gsyslimits.h $fix_dir/syslimits.h; \rn fi; \rn chmod a+r $fix_dir/syslimits.h; \rn done; \rn firnThe directory that should contain system headers does not exist:rn /mingw/includernmake[3]: *** [stmp-fixinc] Error 1rnmake[3]: Leaving directory `/gcc-4.6.2/host-i686-pc-mingw32/gcc'rnmake[2]: *** [all-stage1-gcc] Error 2rnmake[2]: Leaving directory `/gcc-4.6.2'rnmake[1]: *** [stage1-bubble] Error 2rnmake[1]: Leaving directory `/gcc-4.6.2'rnmake: *** [all] Error 2rn按照教程已经安装了win32api mpr mpcf gmp libtool regex flex binutils libintl bison libiconv rn貌似能装的都装了 为什么make后还是有这样的错误?卡了好久都无法解决 论坛

构建TOOLCHAIN时编译GCC出错

06-06

-fpic -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -fpic -I. -I. -I../.././gcc -I../../../gcc-4.7.0/libgcc -I../../../gcc-4.7.0/libgcc/. -I../../../gcc-4.7.0/libgcc/../gcc -I../../../gcc-4.7.0/libgcc/../include -DHAVE_CC_TLS -DUSE_TLS -o _fixunssfsi.o -MT _fixunssfsi.o -MD -MP -MF _fixunssfsi.dep -DL_fixunssfsi -c ../../../gcc-4.7.0/libgcc/libgcc2.c rnIn file included from /usr/include/limits.h:27:0,rn from /maxwit/build/toolchain/gcc-4.7.0-build1/./gcc/include-fixed/limits.h:169,rn from /maxwit/build/toolchain/gcc-4.7.0-build1/./gcc/include-fixed/syslimits.h:7,rn from /maxwit/build/toolchain/gcc-4.7.0-build1/./gcc/include-fixed/limits.h:34,rn from ../../../gcc-4.7.0/libgcc/libgcc2.c:1733:rn/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directoryrncompilation terminated.rnmake[3]: *** [_fixunssfsi.o] 错误 1rnmake[3]:正在离开目录 `/maxwit/build/toolchain/gcc-4.7.0-build1/i686-pc-linux-gnu/libgcc'rnmake[2]: *** [all-stage1-target-libgcc] 错误 2rnmake[2]:正在离开目录 `/maxwit/build/toolchain/gcc-4.7.0-build1'rnmake[1]: *** [stage1-bubble] 错误 2rnmake[1]:正在离开目录 `/maxwit/build/toolchain/gcc-4.7.0-build1'rnmake: *** [all] 错误 2rnrn构建TOOLCHAIN时编译GCC出错,但我在另外一台机器上编译通过。是不是我的什么依赖关系还没建好啊。我能想到的全更新了rnrn付编译脚本rn../gcc-4.7.0/configure \rn --prefix=/usr \rn --build=$BUILD_PLAT \rn --host=$BUILD_PLAT \rn --target=$TARGET_PLAT \rn --with-sysroot=$ROOTFS_PATH \rn --without-headers \rn --with-newlib \rn --disable-libada \rn --disable-multilib \rn --disable-nls \rn --disable-decimal-float \rn --disable-libgomp \rn --disable-libmudflap \rn --disable-libssp \rn --disable-shared \rn --disable-threads \rn --enable-long-long \rn --enable-languages=c \rn --disable-libquadmath \rn --disable-libquadmath-support \rn $GCC_CPU_OPT \rn || exit 1rnrnmake && \rnmake DESTDIR=$TOOLCHAIN_PATH install || exit 1rnrnrn 论坛

windows下用MinGw编译liunx0.01内核时,链接出错

03-24

错误信息:rnld -m i386pe -Ttext 0 -e startup_32 -M --image-base 0x0000 boot/head.o init/marnin.o \rnkernel/kernel.o mm/mm.o fs/fs.o \rnlib/lib.a \rn-o tools/system.exe >system.maprnkernel/kernel.o(.text+0xd5):sched.c: undefined reference to `current'rnkernel/kernel.o(.text+0xdd):sched.c: undefined reference to `current'rnkernel/kernel.o(.text+0x118):sched.c: undefined reference to `gdt'rnkernel/kernel.o(.text+0x120):sched.c: undefined reference to `gdt'rnkernel/kernel.o(.text+0x128):sched.c: undefined reference to `gdt'rnkernel/kernel.o(.text+0x12e):sched.c: undefined reference to `gdt'rnkernel/kernel.o(.text+0x135):sched.c: undefined reference to `gdt'rnkernel/kernel.o(.text+0x13c):sched.c: more undefined references to `gdt' followrnkernel/kernel.o(.text+0x1e7):sched.c: undefined reference to `timer_interrupt'rnkernel/kernel.o(.text+0x1f8):sched.c: undefined reference to `idt'rnkernel/kernel.o(.text+0x1fe):sched.c: undefined reference to `idt'rnkernel/kernel.o(.text+0x213):sched.c: undefined reference to `system_call'rnkernel/kernel.o(.text+0x224):sched.c: undefined reference to `idt'rnkernel/kernel.o(.text+0x22a):sched.c: undefined reference to `idt'rnkernel/kernel.o(.text+0x22f):sched.c: undefined reference to `my_call'rnkernel/kernel.o(.text+0x23b):sched.c: undefined reference to `idt'rnkernel/kernel.o(.text+0x241):sched.c: undefined reference to `idt'rnkernel/kernel.o(.text+0x5cf):fake: undefined reference to `sys_call_table'rnkernel/kernel.o(.text+0x5d5):fake: undefined reference to `current'rnkernel/kernel.o(.text+0x5e6):fake: undefined reference to `current'rnkernel/kernel.o(.text+0x5ec):fake: undefined reference to `task'rnkernel/kernel.o(.text+0x63f):fake: undefined reference to `verify_area'rnkernel/kernel.o(.text+0x688):fake: undefined reference to `do_exit'rnkernel/kernel.o(.text+0x6ac):fake: undefined reference to `jiffies'rnkernel/kernel.o(.text+0x6bd):fake: undefined reference to `do_timer'rnkernel/kernel.o(.text+0x6d0):fake: undefined reference to `do_execve'rnkernel/kernel.o(.text+0x6d9):fake: undefined reference to `find_empty_process'rnkernel/kernel.o(.text+0x6e8):fake: undefined reference to `copy_process'rnkernel/kernel.o(.text+0x712):fake: undefined reference to `do_hd'rn由于帖子长度限制 删掉中间一些连接错误提示rnkernel/kernel.o(.text+0x3a0c):fake: undefined reference to `table_list'rnkernel/kernel.o(.text+0x4181):fake: undefined reference to `table_list'rnkernel/kernel.o(.text+0x4189):fake: undefined reference to `table_list'rnkernel/kernel.o(.text+0x41f1):fake: undefined reference to `table_list'rnkernel/kernel.o(.text+0x4212):fake: undefined reference to `do_tty_interrupt'rnkernel/kernel.o(.text+0x4a49):hd.c: undefined reference to `hd_interrupt'rnkernel/kernel.o(.text+0x4a5a):hd.c: undefined reference to `idt'rnkernel/kernel.o(.text+0x4a60):hd.c: undefined reference to `idt'rnkernel/kernel.o(.text+0x5f22):serial.c: undefined reference to `rs1_interrupt'rnkernel/kernel.o(.text+0x5f34):serial.c: undefined reference to `idt'rnkernel/kernel.o(.text+0x5f3a):serial.c: undefined reference to `idt'rnkernel/kernel.o(.text+0x5f3f):serial.c: undefined reference to `rs2_interrupt'rnkernel/kernel.o(.text+0x5f4b):serial.c: undefined reference to `idt'rnkernel/kernel.o(.text+0x5f51):serial.c: undefined reference to `idt'rnkernel/kernel.o(.data+0x8):shell.c: undefined reference to `sys_fork'rnkernel/kernel.o(.data+0x2c):shell.c: undefined reference to `sys_execve'rnkernel/kernel.o(.data+0x29c):shell.c: undefined reference to `pg_dir'rnmm/mm.o(.text+0x9a3):memory.c: undefined reference to `pg_dir'rnmm/mm.o(.text+0xa21):fake: undefined reference to `do_no_page'rnmm/mm.o(.text+0xa28):fake: undefined reference to `do_wp_page'rnmake: *** [tools/system.exe] Error 1rn求达人解释rnrn====================================================================================================================rnrnmakefile文件:rn#rn# Makefile for linux.rn# If you don't have '-mstring-insns' in your gcc (and nobody but me has :-)rn# remove them from the CFLAGS defines.rn#rnrnAS86 =as86 -0 -arnCC86 =cc -0rnLD86 =ld86 -0rnrnAS =asrnLD =ldrn#LDFLAGS = -m elf_i386 -Ttext 0 -e startup_32rnLDFLAGS = -m i386pe -Ttext 0 -e startup_32 -M --image-base 0x0000rnCC =gcc $(RAMDISK)rn#CFLAGS =-Wall -O2 -fomit-frame-pointerrnCFLAGS =-Wall -O2 -g -fomit-frame-pointer -fno-builtinrnCPP =cpp -nostdinc -IincludernrnARCHIVES=kernel/kernel.o mm/mm.o fs/fs.ornLIBS =lib/lib.arn.c.s:rn $(CC) $(CFLAGS) \rn -nostdinc -Iinclude -S -o $*.s $ Imagern## tools\build.exe boot/bootsect.bin boot/setup.bin $(KERNEL_FILE) $(ROOT_DEV) rn# ./ndisasm -b32 tools/kernel > System.asmrn# rm tools/kernel -frn# syncrnrndisk:Imagern dd if=Image of=/dev/fd0 bs=8192rn#tools/build: tools/build.crn# $(CC) $(CFLAGS) \rn# -o tools/build tools/build.crntools/build.exe: tools/build.crn $(CC) $(CFLAGS) -o tools/build tools/build.c rnrnboot/head.o: boot/head.srn gcc -I./include -traditional -c boot/head.s -o boot/head.orn# (gcc -D__KERNEL__ -I./include -traditional -c boot/head.s & move /Y head.o boot\)rn# mv head.o boot/rn rnrntools/system.exe: boot/head.o init/main.o \rn $(ARCHIVES) $(LIBS)rn $(LD) $(LDFLAGS) boot/head.o init/main.o \rn $(ARCHIVES) \rn $(LIBS) \rn -o tools/system.exe >system.map rn# nm tools/system | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)'| sort > System.maprnrnrnkernel/kernel.o:rn# (cd kernel; make)rn (cd kernel & make)rnrnmm/mm.o:rn# (cd mm; make)rn (cd mm & make)rnrnfs/fs.o:rn# (cd fs; make)rn (cd fs & make)rnrnlib/lib.a:rn# (cd lib; make)rn (cd lib & make)rnrnboot/boot: boot/boot.o tools/system.exern $(LD86) -s -o boot/boot boot/boot.ornboot/boot.o: boot/boot.srn $(AS86) -o $@ $ backup.Z)rn syncrnrndep:rn sed '/\#\#\# Dependencies/q' < Makefile > tmp_makern (for i in init/*.c;do echo -n "init/";$(CPP) -M $$i;done) >> tmp_makern cp tmp_make Makefilern (cd fs; make dep)rn (cd kernel; make dep)rn (cd mm; make dep)rnrn### Dependencies:rninit/main.o : init/main.c include/unistd.h include/sys/stat.h \rn include/sys/types.h include/sys/times.h include/sys/utsname.h \rn include/utime.h include/time.h include/linux/tty.h include/termios.h \rn include/linux/sched.h include/linux/head.h include/linux/fs.h \rn include/linux/mm.h include/asm/system.h include/asm/io.h include/stddef.h \rn include/stdarg.h include/fcntl.h rn 论坛

没有更多推荐了,返回首页