使用MinGw标准2011进行基本编译
Basic compilation with MinGw standard 2011
程序编译过程中出现意外错误。
(我必须使用2011年标准的std::regex
.)
在我的MinGw cmd中,我进入我的程序所在的文件夹,并写入:
c++ -Wall -c -std=c++0x main.cpp
这里一切都很好,但是当我写
c++ -Wall - 0 -std=c++0x main.exe main.o
它告诉我:
g++.exe:错误:main.exe: No such file or directory
为什么?
因为你写开关的顺序不对。-o
要求目标文件名在其后面。
这里,你已经告诉GCC将main.exe
和main.o
链接到可执行文件-std=c++0x
中,而main.exe
甚至还不存在。
g++ -Wall -o -std=c++0x main.exe main.o
# ^^^^^^^^^^^^^ ????????
相反,告诉它链接main.o
到可执行的main.exe
,在c++ 0x模式下:
g++ -Wall -std=c++0x -o main.exe main.o
# ^^^^^^^^^^^
相关文章:
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- MinGw 无法从 cmake 编译测试文件
- Mingw-64 在构建和安装后不会编译 openCV 代码
- 当我尝试通过 mingw 使用 CMake 和 SFML 库编译项目时出错
- 尝试在Windows上执行C++时出错(通过MinGW编译)
- 如何使用命令提示符、记事本和 MinGW 使用主文件、头文件和实现文件编译C++程序?
- 如何构建一个 setup.py 来编译C++使用 Python、pybind11 和 Mingw-w64 的扩展?
- 使用 MINGW gcc 编译时,不会为 std::string 调用重载的新运算符
- 如何使用MinGW编译器和SSL支持静态编译Qt
- 使用 MinGW 在 Windows 上的命令行编译C++文件
- 无法使用 mingw-w64 g++ 编译:找不到 <wchar.h>
- 使用 编译时。RES File with MinGW G++, .无法识别 RES
- Dev c++ mingw 不再编译
- MinGW-w64 编译失败,nullptr_t
- 使用Mingw-w64编译Google测试
- G++无法编译Win7,64位(MinGW.org GCC-6.3.0-1)
- wxWidgets 编译 MinGW - 错误 1 和错误 2
- Linphone编译-Mingw 64位-找不到GNU gettext工具;intltool需要
- 在Windows下为OpenCV编译MinGW库
- 无法编译[MinGW]