简体   繁体   English

如何使用 Makefile 编译和运行这个 C 程序?

[英]How to compile and run this C program using Makefile?

Fairly new to Linux and Rasp Pi, I am trying to follow a guide to flash a USB modem. Linux 和 Rasp Pi 相当新,我正在尝试遵循 flash 和 USB 调制解调器的指南。 The guide simply says "compile and run this program", which I of course don't know how to do and there are no instructions.该指南只是说“编译并运行这个程序”,我当然不知道该怎么做,也没有说明。 I tried researching online but still failed.我尝试在线研究但仍然失败。

This is the utility: https://github.com/forth32/balong-usbdload这是实用程序: https://github.com/forth32/balong-usbdload

It appears to be written in C and has Makefile but that's everything I know.它似乎是用 C 编写的,并且有 Makefile 但这就是我所知道的一切。

Can someone explain to me how to compile and run this?有人可以向我解释如何编译和运行它吗? I spent 2 days trying.我花了2天时间尝试。

I tried "make" and it produced.o files.我尝试了“make”,它产生了.o 文件。 however I then tried to use the program from within the folder (using the command line) as such:但是我随后尝试从文件夹中使用该程序(使用命令行),如下所示:

sudo balong-usbdload -p /dev/ttyUSB0 usblsafe-3372h.bin

but I got an error saying "no such command..."但我得到一个错误说“没有这样的命令......”

How do I run this program?我如何运行这个程序?

Thanks a lot !非常感谢 !

Linux requires local executables to be run with relative path notation: Linux 要求使用相对路径表示法运行本地可执行文件:

sudo ./balong-usbdload -p /dev/ttyUSB0 usblsafe-3372h.bin

Running executables without any path notation (eg balong-usbdload ) requires the executable to be located in one of the $PATH directories.运行不带任何路径表示法的可执行文件(例如balong-usbdload )要求可执行文件位于$PATH目录之一。

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

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