Example of resolving C compilation errors under UbuntuLinux

Source: Internet
Author: User
The just-installed Linux and Ubuntu versions. I wrote a C program and compiled it using gcc. the following error occurs: test. c: 1: 18: error: stdio. h: Nosuchfileordirectory: Ubuntu Linux is very small. Many packages have not been installed yet. You need to install some file packages to compile the C program. Solution: Input in terminal: The sudoapt-getinstalllibc6-dev system will

The just-installed Linux and Ubuntu versions. I wrote a C program and compiled it using gcc. the following error occurs:

Test. c: 1: 18: error: stdio. h: No such file or directory

Cause: Ubuntu Linux is very small, and many packages have not been installed yet. You need to install some file packages to compile the C program.

Solution: Enter:

Sudo apt-get install libc6-dev

The system automatically downloads and installs a file package. After automatic installation, the c program can be compiled.

The generated Executable File a. out. Enter a. out directly on the terminal and the following error will occur:

Bash: a. out: command not found

Cause: in Linux, no default program is executed in the current directory. If a. out is used directly, the system searches for programs to be modified in the path of path. If no program is found, command not found appears. Therefore, to run your own program, you must add the absolute path of the program. That is,./a. out

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.