DEV Community

Cover image for linux c/cpp in wsl ubuntu setup
Dennis kinuthia
Dennis kinuthia

Posted on

4 3

linux c/cpp in wsl ubuntu setup

Configuring for c/c++

if you haven't set up wsl enviroment
check this out first

download gcc compiler and betty linter for c/c++ development
Type the following one by one

sudo apt install build-essential
Enter fullscreen mode Exit fullscreen mode
sudo apt update
Enter fullscreen mode Exit fullscreen mode
sudo apt-get install manpages-dev
Enter fullscreen mode Exit fullscreen mode

Then to check if installed type
gcc --version

For the betty linter:
Go to the betty repo:

And clone the repo

cd Betty

sudo ./install.sh

Create a file called betty and paste in

#!/bin/bash
# Simply a wrapper script to keep you from having to use betty-style
# and betty-doc separately on every item.
# Originally by Tim Britton (@wintermanc3r), multiargument added by
# Larry Madeo (@hillmonkey)

BIN_PATH="/usr/local/bin"
BETTY_STYLE="betty-style"
BETTY_DOC="betty-doc"

if [ "$#" = "0" ]; then
    echo "No arguments passed."
    exit 1
fi

for argument in "$@" ; do
    echo -e "\n========== $argument =========="
    ${BIN_PATH}/${BETTY_STYLE} "$argument"
    ${BIN_PATH}/${BETTY_DOC} "$argument"
done
Enter fullscreen mode Exit fullscreen mode

Once saved, exit file and change permissions to apply to all users with chmod a+x betty
Move the betty file into /bin/ directory or somewhere else in your $PATH with

sudo mv betty /bin/
Enter fullscreen mode Exit fullscreen mode

You can now type betty "filename" to run the Betty linter!
and now you can compile and run linux c code on your windows machine

Image of Quadratic

AI, code, and data connections in a familiar spreadsheet UI

Simplify data analysis by connecting directly to your database or API, writing code, and using the latest LLMs.

Try Quadratic free

Top comments (0)

Jetbrains image

Is Your CI/CD Server a Prime Target for Attack?

57% of organizations have suffered from a security incident related to DevOps toolchain exposures. It makes sense—CI/CD servers have access to source code, a highly valuable asset. Is yours secure? Check out nine practical tips to protect your CI/CD.

Learn more

👋 Kindness is contagious

Dive into this insightful write-up, celebrated within the collaborative DEV Community. Developers at any stage are invited to contribute and elevate our shared skills.

A simple "thank you" can boost someone’s spirits—leave your kudos in the comments!

On DEV, exchanging ideas fuels progress and deepens our connections. If this post helped you, a brief note of thanks goes a long way.

Okay