Skip to content

Instantly share code, notes, and snippets.

@zxubian
Last active August 16, 2023 03:34
Show Gist options
  • Select an option

  • Save zxubian/6b213812c279d8e43cde1cb578eef59e to your computer and use it in GitHub Desktop.

Select an option

Save zxubian/6b213812c279d8e43cde1cb578eef59e to your computer and use it in GitHub Desktop.
Running & Building a C Makefile Project with CLion & WSL (January 2022)

Running & Building a C Makefile Project with CLion & WSL (January 2022)

  • Set CLion Toolchain to WSL
    • Settings/Build, Execution & Deployment/Toolchains
    • Make sure all checks pass
    • If necessary, install C build tools on WSL side sudo apt-get install build-essential
  • From CLion, use File/Open... -> your MakeFile -> "Open as Project" -Note: if your MakeFile does not contain an "all" target, the CLion Makefile plugin thing might get angry and not parse any of the other targets
  • Go to "Edit Configurations" (on the upper-right)
    • Make sure your configuration is "Makefile Application", and NOT "Makefile Target" ("Makefile Target" produces errors)
    • in the Run/Debug Configuration for your Build Target, set the Executable field to point to the full path to your executable e.g. D:\Dev\my-project\my-library
      • this should correspond to the output of Makefile recipe for this build target
  • If everything is set up correctly, you should be able to build, run and debug
@colinmccarson
Copy link

Thank you very much for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment