[英]How to compile a c++ program using Dev C++ compiler in windows command prompt?
I installed Dev C++ in windows and I worked with that IDE, however I want to compile my program, prog1.cpp
, in windows command prompt. 我在Windows中安装了Dev C ++,并且使用了该IDE,但是我想在Windows命令提示符下编译程序
prog1.cpp
。 I opened cmd in current directory and I have tried following commands that not worked: 我在当前目录中打开了cmd,并且尝试了以下不起作用的命令:
All of above commands cause this error: command not recognized as an internal or external command, operable program or batch file.
以上所有命令均会导致此错误:
command not recognized as an internal or external command, operable program or batch file.
: :
***Note: I don't want to install visual studio and using cl /EHsc prog1.cpp
***注意:我不想安装Visual Studio并使用
cl /EHsc prog1.cpp
What is the command to compile a program in cmd using Dev C++ compiler? 使用Dev C ++编译器在cmd中编译程序的命令是什么?
Dev-C++ is not a compiler. Dev-C ++不是编译器。 It's an IDE.
这是一个IDE。
You need to add the path to the compilers before you can use them. 您需要先将路径添加到编译器,然后才能使用它们。
Assume you installed Dev-C++ to C:\\Program Files\\Dev-Cpp
, then you need to add the following paths to %PATH%
variable: 假设您将Dev-C ++安装到
C:\\Program Files\\Dev-Cpp
,则需要将以下路径添加到%PATH%
变量:
C:\Program Files\Dev-Cpp\MinGW64\bin
C:\Program Files\Dev-Cpp\MinGW64\libexec\gcc\mingw32\6.3.0
C:\Program Files\Dev-Cpp\MinGW64\mingw32\bin
You can add it temporarily to one Command Prompt session with 您可以使用以下命令将其临时添加到一个命令提示符会话中
path %PATH%;<more paths here>
Or refer to Google to learn how to add it permanently to your system. 或者参考Google以了解如何将其永久添加到您的系统中。
After resolving the %PATH%
issue, you'll be able to compile your programs with gcc
(C) or g++
(C++). 解决
%PATH%
问题后,您将可以使用gcc
(C)或g++
(C ++)编译程序。 Note that c
and cl
are still unavailable (because they're not installed). 请注意,
c
和cl
仍然不可用(因为未安装)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.