m32 在64系统编译32位的时候出现错误
### 在window系统下编译之前电脑和虚拟机都是32位然后编译出来运行一直畅快得很。
现在都是64系统,当有天将原来的工程项目拿出来重现编译的时候,才发先无论是window 还是 linux 都是非常折腾的事情。
- 突然联想到如果是新的项目,什么用Golang替代C/C++ 省心不少。 当前切换过程的是极端纠结的。
### 编译时候使用-m32 -m64 区别编译出64bit还是32bit
- 在linux 系统,没遇到问题。
- 在window系统,却没有找到答案。 $_$ 习惯性将遇到问题纪录一下。
g++ -D_DEBUG -c TestMakefile.cpp -g -Wall -O0 -m32 -o TestMakefile.o
g++ -D_DEBUG ./TestMakefile.o -o TestMakefile
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `./TestMakefile.o' is incompatible with i386:x86-64 output
./TestMakefile.o: In function `printf':
C:/TDM-GCC-64/x86_64-w64-mingw32/include/stdio.h:300: undefined reference to `___mingw_vprintf'
./TestMakefile.o: In function `main':
D:\vbubuntu\share\test\TestMakefile/TestMakefile.cpp:11: undefined reference to `___main'
D:\vbubuntu\share\test\TestMakefile/TestMakefile.cpp:14: undefined reference to `__ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_'
D:\vbubuntu\share\test\TestMakefile/TestMakefile.cpp:14: undefined reference to `__ZSt4cout'
D:\vbubuntu\share\test\TestMakefile/TestMakefile.cpp:14: undefined reference to `__ZNSolsEPFRSoS_E'
./TestMakefile.o: In function `__tcf_0':
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iostream:74: undefined reference to `__ZNSt8ios_base4InitD1Ev'
./TestMakefile.o: In function `__static_initialization_and_destruction_0':
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iostream:74: undefined reference to `__ZNSt8ios_base4InitC1Ev'
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iostream:74: undefined reference to `_atexit'
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): In function `main':
C:/crossdev/src/mingw-w64-v4-git/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
Makefile:29: recipe for target 'TestMakefile' failed
make: *** [TestMakefile] Error 1
- 没找到答案,后续。 @-@
本文来自博客园,作者:ljymoonlight,转载请注明原文链接:https://www.cnblogs.com/ljymoonlight/p/14288584.html
posted on 2021-01-17 12:03 ljymoonlight 阅读(849) 评论(0) 编辑 收藏 举报