gpt4 book ai didi

c++ - 使用 Make 使用 g++ 编译时出现 "Bad command or file name"错误

转载 作者:行者123 更新时间:2023-11-28 00:11:54 26 4
gpt4 key购买 nike

我最近安装了 MinGW 并学习了如何使用 Make。但是每当我尝试使用 make 编译 CPP 源文件时,我都会出错。以下是输出:

MAKE Version 3.6  Copyright (c) 1991 Borland International

Available memory 33397872 bytes

mingw32-g++ main.cpp --std=c++11 -o program
Bad command or file name

main.cpp 是一个非常简单的“Hello World”类型的程序。当我直接在命令提示符中使用该命令时,该命令有效。
我正在使用 MinGW 运行 Windows 8.1。 GCC 版本 4.8

最佳答案

我想你想学GNU make ,而不是 1991 年的 Borland。

确保您在 Cygwin 中安装了 GNU make 包。通过在 bash 命令行中键入来检查它是否存在:

$ type -a make

它应该以类似的方式响应:

/usr/bin/make
/bin/make

然后:

$ make --version

应该以类似的方式响应:

GNU Make 4.1
Built for x86_64-unknown-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

关于c++ - 使用 Make 使用 g++ 编译时出现 "Bad command or file name"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32589496/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com