Reputation: 1
I created a very basic game with C++ using Raylib Package, i install Raylib from vcpkg but don't know how to compile it can you please help me out Error while Compiling the Main.cpp in which my game in written
I try to compile My Main.cpp by using, g++ Main.cpp command but its giving me error I want to Run the code and I want the GUI that Raylib package provides to play the game!
Upvotes: 0
Views: 2372
Reputation: 1638
I highly advise you to learn about C++ on your own at least before you post a question on StackOverflow. That being said I will answer your question:
First of all vcpkg is a package manager designed to make it easier for you to manage dependencies for a given C++ project. Vcpkg is usually used in combination with CMake (a build tool that makes it easier to generate a makefile for your C++ project).
So if you wish to use vcpkg, I highly recommend you go to the official site and look up a guide on how to use it and learn about CMake as well.
Now on to your error:
g++ is telling you exactly what is wrong. It doesn't know where to find raylib.h
and in order for g++ to find it, you need to pass an "include flag" to it with the path to the folder where it can find the header file, i.e.:
g++ -I/path/to/raylib/header_folder main.cpp
However most likely raylib is a static/dynamic (already compiled) library so you also need to specify the path to the library so that the linker knows where to find it, i.e.:
g++ -I/path/to/raylib/header_folder -L/path/to/raylib/Lib_folder -lname_of_library(without lib prefix) main.cpp
Hope it helps!
Upvotes: 0