- 1 year ago
Compiling cpp using LLVM 11.0.0 on Windows 10 mashine
To compile C++ code using LLVM 11.0.0 on a Windows 10 machine, you can follow these steps:
Install LLVM: Download the LLVM binaries for Windows from the official LLVM website (https://releases.llvm.org/download.html). Look for the LLVM version 11.0.0 specifically. Choose the appropriate package based on your system architecture (32-bit or 64-bit). Extract the downloaded archive to a directory of your choice.
Set up environment variables: Add the LLVM installation directory to your system's PATH environment variable. This allows you to access the LLVM executables from anywhere in the command prompt. To do this:
- Open the Start menu and search for "Environment Variables."
- Select "Edit the system environment variables."
- Click on "Environment Variables" at the bottom-right of the System Properties window.
- In the System Variables section, scroll down and select the "Path" variable.
- Click "Edit" and add the LLVM bin directory (e.g.,
C:\path\to\llvm\bin
) to the list of paths. Separate multiple paths with a semicolon. - Click "OK" to save the changes.
Compile C++ code: Open the command prompt and navigate to the directory containing your C++ source code. Use the
clang++
command (LLVM's C++ compiler) to compile your code. For example:luaclang++ -o output.exe input.cpp
Replace
output.exe
with the desired name for the compiled executable andinput.cpp
with the name of your C++ source file.Run the compiled executable: Once the compilation is successful, you can run the compiled executable by typing its name in the command prompt and pressing Enter. For example:
luaoutput.exe
By following these steps, you should be able to compile and run C++ code using LLVM 11.0.0 on your Windows 10 machine. Make sure you have the necessary dependencies and libraries installed, and that your C++ code is compatible with the version of LLVM you are using.