Clang 15

About programming and getting involved with Linux Mint development
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Post Reply
Michael Thomas Greer
Level 1
Level 1
Posts: 4
Joined: Tue Feb 13, 2024 10:52 pm

Clang 15

Post by Michael Thomas Greer »

Hello!

I just bought a brand new PC and am installing Mint. So far, very happy. :D

I want to install a proper C & C++ development environment, but while I have messed with *nixen in days past, I am a little over my head here. I can usually find a succinct list of things to do to install the latest <package> using the Google, but my google-fu is off and I am uncertain how to proceed to get the latest/correct GCC and Clang environments.

Linux Mint 21.3 Cinnamon
Cinnamon 6.0.4
Kernel 6.5.0-17-generic
12th Gen Intel Core i7-12700K x 12
NVIDIA 2882

IIRC I must first install GCC, then Clang, then make sure the symlinks in `/usr/bin` are correct. Any caveats I should be aware of?
User avatar
xenopeek
Level 25
Level 25
Posts: 29615
Joined: Wed Jul 06, 2011 3:58 am

Re: Clang 15

Post by xenopeek »

Linux Mint 21.3 has clang 14 for easy installation through Synaptic Package Manager or with apt install clang. It will install required dependencies automatically. You probably will want to install build-essential apt install build-essential as well, which is a set of common packages for compiling.

Linux Mint 22 due mid this year will have clang 17. Is having clang 15 now really important?
Image
Michael Thomas Greer
Level 1
Level 1
Posts: 4
Joined: Tue Feb 13, 2024 10:52 pm

Re: Clang 15

Post by Michael Thomas Greer »

OK, thank you!
I can live with Clang 14 -- it has support for C++17 (and a lot of C++20), which will do.

sudo apt install build-essential clang

Left me with the ability to compile using g++ but not clang++. After further googling it appears that Clang 14 requires:

sudo apt install libstdc++-12-dev

(This was my simple test program:)

Code: Select all

#include <iostream>
#include <string>

int main( int argc, char ** argv )
{
  std::string name = argc > 1 ? argv[1] : "world";
  std::cout << "Hello " << name << "!\n";
}
Now things work!

Code: Select all

% clang++ -Wall -Wextra -pedantic-errors -O3 -std=c++17 hello.cpp -o hello
% ./hello everyone
Hello everyone!
Post Reply

Return to “Programming & Development”