- 1 year ago
Getting LLVM 6.0.0 lld-link to work with Code::Blocks
Comment
1 / 1
To get LLVM 6.0.0 lld-link to work with Code::Blocks, you need to set up the Code::Blocks project correctly to use LLVM as the compiler and linker. Here's a step-by-step guide to help you configure Code::Blocks with LLVM 6.0.0:
Install LLVM 6.0.0:
- Download and install LLVM 6.0.0 from the official LLVM website: https://releases.llvm.org/download.html
- Make sure to install LLVM in a location that is easily accessible and note down the installation path.
Open Code::Blocks:
- Open Code::Blocks on your system.
Create a new project:
- If you don't already have a project, create a new one by going to "File" > "New" > "Project..."
Set the Compiler:
- In the "New from template" window, select the "Console application" template (or any other template you prefer) and click "Go."
- Select "LLVM Clang" as the compiler and click "Next."
Configure the Compiler:
- In the next window, set up the Compiler settings:
- Compiler's installation directory: Browse and set the path to your LLVM installation (e.g., C:\Program Files\LLVM).
- Compiler's installation subdirectory: Set the appropriate subdirectory (e.g., bin).
- C compiler: clang.exe
- C++ compiler: clang++.exe
- Click "Next" to proceed.
- In the next window, set up the Compiler settings:
Configure the Linker:
- In the next window, set up the Linker settings:
- Linker's installation directory: Browse and set the path to your LLVM installation (e.g., C:\Program Files\LLVM).
- Linker's installation subdirectory: Set the appropriate subdirectory (e.g., bin).
- Linker for dynamic libs: lld-link.exe (this is the linker you want to use)
- Click "Next" to proceed.
- In the next window, set up the Linker settings:
Set the Build Target:
- Set the name and location of your project and click "Finish."
Adjust Project Properties (Optional):
- After creating the project, you can further adjust the project properties by right-clicking on the project name in the "Projects" pane and selecting "Build options..."
- In the "Compiler settings" tab, you can adjust various compiler flags, include directories, etc., as needed.
Build and Run:
- Write your code in the main.cpp file (or any other source file you create) and build the project by clicking on the "Build" button (hammer icon) in the toolbar.
- Run your program using the "Run" button (green arrow icon) in the toolbar.
That's it! Your Code::Blocks project should now be configured to use LLVM 6.0.0 lld-link as the compiler and linker. You can write and compile your C++ code using the power of LLVM.