Problem connecting llama.cpp in Visual Studio C++ project #11359
-
Hello! I'm having trouble connecting the llama.cpp library to my C++ project in Visual Studio. My operating system is Windows 11. Visual Studio Version: Community 2022, version 17.12.4 llama.cpp Version: b4527 Operating System: Windows 11 Steps I've taken: I built llama.cpp from source using the following commands in the repository folder: cmake -B build I created a new C++ project in Visual Studio (empty project). This is where I encountered the problem: I don't understand how to properly connect the built library to my Visual Studio project. What I've tried: I searched for guides online but couldn't find one that suited my case. I need help with the following questions: Which files from the build folder should I use for linking (e.g., .lib, .dll, .h)? How do I correctly add the paths to these files in the Visual Studio project settings? Do I need to copy any files to my project folder? I would be very grateful for any help and detailed instructions! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello— What you are looking for I believe is to specify the Visual Studio CMake generators. The nice thing about CMake is that it creates the Visual Studio solution automatically and all you have to do is double-click it! So an off-the-cuff idea, open cmd.exe and: cd llama.cpp
mkdir build & cd build
cmake .. -G "Visual Studio 17 2022" -A x64 And this will generate the solution file. You can build from the command line after with Note: this assumes x64 architecture but other ones can be specified. https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html |
Beta Was this translation helpful? Give feedback.
Hello—
What you are looking for I believe is to specify the Visual Studio CMake generators. The nice thing about CMake is that it creates the Visual Studio solution automatically and all you have to do is double-click it!
So an off-the-cuff idea, open cmd.exe and:
And this will generate the solution file. You can build from the command line after with
cmake --build .
or simply open the solution file and build, debug, etc.Note: this assumes x64 architecture but other ones can be specified.
https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html