简体   繁体   English

如何使用“参数”在 Visual Studio 中运行 C 程序

[英]How to run C program in Visual Studio with "parameters"

I'm not sure if "parameters" is the correct term, but I don't know what else to put.我不确定“参数”是否是正确的术语,但我不知道还能放什么。 I have a C program that displays "Hello World!"我有一个显示“Hello World!”的 C 程序in the terminal when I run it.当我运行它时在终端中。 But I have to follow specific steps before I run it.但是在运行之前我必须遵循特定的步骤。 Assuming I am in the correct directory, I first must compile the .c file.假设我在正确的目录中,我首先必须编译 .c 文件。 In the terminal I type,在我输入的终端中,

gcc -Wall -std=c99 hello_world.c

then to run the program, I type然后运行程序,我输入

./a.out

My question is, how do I run that .c file in Visual studios while using the "gcc -Wall -std=c99".我的问题是,如何在使用“gcc -Wall -std=c99”的同时在 Visual Studios 中运行该 .c 文件。 To be honest, I have no ides what "gcc -Wall -std=c99" does exactly, but I have to use it.老实说,我不知道“gcc -Wall -std=c99”到底是做什么的,但我必须使用它。

gcc -Wall -std=c99 compiles the c file with the c99 standard. gcc -Wall -std=c99使用 c99 标准编译 c 文件。 I don't know what your exact question is here, but to run both in one command you would need to do: gcc -Wall -std=c99 && ./a.out我不知道您的确切问题是什么,但是要在一个命令中同时运行这两个命令,您需要执行以下操作: gcc -Wall -std=c99 && ./a.out

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM