简体   繁体   English

如何在 AWS EC2 Linux 实例上运行编译和运行 c 文件?

[英]How do I run compile and run a c file on an AWS EC2 Linux Instance?

I am trying to run an executable compiled from a c file on an AWS EC2 Linux Instance and when i try to run the executable I get a bash: command not found error and cant figure out why, below is my terminal commands.我正在尝试运行从 AWS EC2 Linux 实例上的 c 文件编译的可执行文件,当我尝试运行可执行文件时,我得到一个 ZD574D4BB40C84861791A694A999CCE69 错误,为什么下面是我的命令终端错误,为什么

`[ec2-user@ip-172-31-7-57 ~]$ gcc server.c -o server
[ec2-user@ip-172-31-7-57 ~]$ ls
server  server.c  test
[ec2-user@ip-172-31-7-57 ~]$ server 51717
-bash: server: command not found
[ec2-user@ip-172-31-7-57 ~]$ `

The only install I have run is我运行的唯一安装是

sudo yum groupinstall "Development Tools"

inorder to install gcc for compilation.为了安装 gcc 进行编译。 Am I missing an install here?我错过了这里的安装吗?

Unlike windows systems, Linux systems don't look in the current directory by default when looking for a program to run.与 windows 系统不同,Linux 系统在查找要运行的程序时默认不查找当前目录。 You need to give the path to the executable.您需要提供可执行文件的路径。

./server 51717

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

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