I use codeblocks. I would recommend you the same. Maybe you need to install build-essentials to compile programs.

sudo apt-get install build-essential
Answer from neo1691 on askubuntu.com
🌐
DataFlair
data-flair.training › blogs › install-c-on-linux
How to Install C - Learn to Install GCC Compiler for Ubuntu - DataFlair
July 3, 2019 - In this installation tutorial, we will help you to write and compile your own programs in the C programming language using terminal for Linux Operating System.
🌐
Scaler
scaler.com › home › topics › how to install c and gcc compiler on linux?
How to Install C and GCC Compiler on Linux - Scaler Topics
June 10, 2022 - We are going to install the GCC compiler using the Linux terminal to install C on Linux. The GCC Compiler, and several other libraries and utilities required for building applications, can be found in the default Ubuntu repositories (Ubuntu is a Linux-based Operating System) under the build-essential meta-package.
🌐
Linux.org
linux.org › home › forums › general linux forums › ask tuxbot (archived)
Installing C compiler | Linux.org
December 21, 2023 - sudo pacman -S base-devel Once you have the C compiler installed, you can start writing and compiling C and C++ code. If you need any help with coding or have any more questions, feel free to ask, dude! You must log in or register to reply here.
🌐
MakeUseOf
makeuseof.com › home › linux › how to install a c compiler on linux
How to Install a C Compiler on Linux
October 23, 2021 - You can install Clang using your package manager. On Debian and Ubuntu, just install the clang package: ... Whether you're just learning C or are an experienced C programmer, you can easily install two major C compilers for Linux—GCC and Clang.
🌐
YouTube
youtube.com › watch
Enable Linux terminal in windows and install C compiler in Linux - YouTube
In this video, we will learn1. How to install C compiler in linux by enabling windows subsystem for linux2. Installing GCC compiler in linux3. Installing GDB...
Published   March 5, 2020
🌐
nixCraft
cyberciti.biz › nixcraft › howto › linux › ubuntu linux install gnu gcc compiler and development environment
Ubuntu Linux Install GNU GCC Compiler and Development Environment - nixCraft
August 11, 2025 - Fig.01: How do I install development tools for Ubuntu Linux? Type the following commands: $ whereis gcc make $ gcc --version $ make -v · Fig.02: Finding out installed make and gcc version · Type the following command: $ sudo apt-get install manpages-dev man-db manpages-posix-dev To view library calls (functions within program libraries), enter: $ man 3 scanf $ man 2 execve $ man 2 fork You can write a small program to test GNU c/c++ compiler: $ vi test.cpp Append the following code: #include <iostream> // My first program using namespace std; int main(){ cout << "Hello, World!\n"; return 0; }
Find elsewhere
🌐
Cherry Servers
cherryservers.com › home › blog › linux › how to install gcc on ubuntu 22.04 [and compile a c program]
How to Install GCC on Ubuntu 22.04 [and Compile a C Program] | Cherry Servers
November 7, 2025 - This article will show you how to install GCC on Ubuntu 22.04, compile a C program, and briefly explain the GCC compiler.
🌐
nixCraft
cyberciti.biz › nixcraft › howto › gnu c / c++ › how to compile and run a c/c++ code in linux
How To Compile And Run a C/C++ Code In Linux - nixCraft
June 29, 2024 - If you are using Fedora, Red Hat, ... command/apt command to install GNU c/c++ compiler: $ sudo apt-get update $ sudo apt-get install build-essential manpages-dev · Type the following whereis command and which command to ...
🌐
LinuxConfig
linuxconfig.org › home › how to install gcc the c compiler on ubuntu 18.04 bionic beaver linux
How to install GCC the C compiler on Ubuntu 18.04 Bionic Beaver Linux
September 22, 2025 - The following linux command will install gcc compiler on on Ubuntu 18.04 Bionic Beaver. Open up terminal and enter: ... Another way to install gcc compiler is to install it as part of build-essential package. build-essential package will also install additional libraries as well as g++ compiler. In ...
🌐
LinuxConfig
linuxconfig.org › home › how to install gcc the c compiler on ubuntu 22.04 lts jammy jellyfish linux
How to install GCC the C compiler on Ubuntu 22.04 LTS Jammy Jellyfish Linux
January 8, 2024 - In this tutorial, we saw how to install GCC, the very simple C compiler on Ubuntu 22.04 Jammy Jellyfish. We also learned how to create a simple Hello World C program in order to test the new compiler. ... Support LinuxConfig.org through our official merchandise store.
🌐
LinuxConfig
linuxconfig.org › home › how to install gcc the c compiler on ubuntu 20.04 lts focal fossa linux
How to install GCC the C compiler on Ubuntu 20.04 LTS Focal Fossa Linux
September 21, 2025 - Learn how to install GCC on Ubuntu, check its version, and compile C programs. Enhance your Linux development skills quickly.
🌐
nixCraft
cyberciti.biz › nixcraft › howto › centos › download and install c, c++ compiler on red hat enterprise linux 5 (rhel)
Download and Install C, C++ Compiler on Red Hat Enterprise Linux 5 (RHEL) - nixCraft
April 5, 2024 - Mount your RHEL/CentOS Linux CD/DVD and install the following packages using rpm command: # rpm -ivh gcc* You can download and install packages using RHN and yum command: # yum install gcc gcc-c++ autoconf automake · This entry is 4 of 13 in the Linux GNU/GCC Compilers Tutorial series.
🌐
Linux.org
linux.org › home › forums › general linux forums › general linux topics
How To Install My C Program | Linux.org
April 8, 2020 - At the most complex level - you could add a makepkg target to your make-file that will build a Debian package for your machine and then you could install/uninstall the .deb package using apt. Personally, I’ve never really looked at packaging. Something I really aught to get onto at some point. But as I know nothing about it - I won't discuss it any further here! For my personal pet projects - If it's just for myself, then rather than putting them in a main system directory like /usr/bin/, I tend to use my personal bin directory /home/username/bin/ and put any man pages in my personal man directory too - /home/username/man/man1/. I like to include man pages for my personal projects - even if they are only for my own use.
🌐
Ubuntu
documentation.ubuntu.com › ubuntu-for-developers › howto › gcc-setup
How to set up a development environment for GCC on Ubuntu - Ubuntu for Developers
December 2, 2025 - From within NetBeans, install the C/C++ Pack by going to Tools ‣ Plugins ‣ Available Plugins ‣ Install. The standard debugger developed for GCC is the GNU Debugger (GDB). Other tools, such as gprof (part of binutils) and · Valgrind provide ...
🌐
VITUX
vitux.com › how-to-write-and-run-a-c-program-in-linux
How to Write and Run a C Program in Linux – VITUX
Enter the following command as root in your Linux Terminal: ... You will be asked to enter the root password; the installation will begin after that.
🌐
GeeksforGeeks
geeksforgeeks.org › installation guide › how-to-install-gcc-compiler-on-linux
How to Install GCC Compiler on Linux? - GeeksforGeeks
July 23, 2025 - Command 2: Now we have to install the build-essential packages, which is also known as a meta-package, it contains the GCC compiler all the other essentials used to compile the software written in C and C++ language. ... It will take some time to install all the essential packages. Command 3: After the second command it will install GCC on your Linux, to verify it is installed correctly, check the version of the GCC.
Top answer
1 of 3
8

In most Linux distributions, there are prepared packages available with the SDL libraries. On Debian and Ubuntu, you can simply sudo apt-get install libsdl-image1.2-dev. In Red Hat, Fedora, and CentOS, you can do sudo yum install SDL_image-devel.

You can get the correct flags for the compiler using sdl-config. The configure script is the “automated” tool for discovering the correct flags, but it is pretty compilicated. If you haven't used C libraries before, it isn't terribly obvious. The -I flag adds a directory to the search path for #include directives. The -L flag adds a directory to the search path for libraries and -l tries to add a library to the program. Compiling C happens in two steps, compiling and linking. Compiling only looks at header files (.h files) and only cares about -I directives; it output object code (.o files). Linking only cares about -L and -l options and attempts to resolve the symbols in the object code. Typically, libraries live in /lib and /usr/lib and headers live in /usr/include. However, headers are often broken out into separate subdirectories and thus require more specific -I directives. Some programs started to include foo-config programs that included the proper directives to compile against the library. pkg-config is a generic version used by many libraries, especially ones related to GNOME.

This is all very different from other languages which typically a) just use sources for libraries (e.g., PERL, Python) or b) have an executable format that contains all the information needed for compilation (e.g., Java, C#).

2 of 3
2

sdl-config would be present as the result of installing libsdl, which you must do before you install libsdl-image.

Why don't you install the packages provided with your distribution?

🌐
TecMint
tecmint.com › home › open source › install c, c++ compiler and development (build-essential) tools in debian/ubuntu
Install C, C++ Compiler and Development (build-essential) Tools in Debian/Ubuntu
November 22, 2021 - In this article we will explain how to install C, C++ compilers and Development (build-essential) Tools in Debian and derivatives such as Ubuntu/Linux Mint.