first, clone this repository
1- sudo apt-get update
2- sudo apt-get install make
3- sudo apt-get install libcurl4-openssl-dev
1- (if you don't have HomeBrew) /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
You can also install it similarly to Windows, but look for the macOS version on this link. Just look for binaries, not the source.
brew install make
2- brew install curl-openssl
(If these two commands didn't work, use the instructions for Windows).
if you got errors using an IDE or editor do the things described in the last paragraph of the windows section
1- for 64-bit Windows: Download this (it already has the dlls) and extract it.
for 32-bit Windows: Download this, extract it and then download and these dlls: libintl3.dll and libiconv2.dll . place the dlls in the bin folder of the extracted file next to the make.exe file. then you have to add the bin folder of the extracted file to the system environment variables, or skip this part and run the make.exe file later using the full path like C:/Users/..../bin/make.exe (not recommended)
2- for adding the path to system environment variables:
1- press the win key and type edit the system environment variables
and hit enter.
2- at the bottem of the opened window click environment "variables".
3- in the "User variavles" find and select "Path", then click edit.
4- click "New" and paste the path to the bin folder or alternatively click browse and navigate to the bin folder and click ok.
5- click ok in the previous windows and close them.
3- Download a binary version of libcurl suitable for you. then extract the downloaded file anywhere.
Optional: Add its include
and lib
directories to the system environment variables path like step 2.
If you are using a code editor like VS Code and it doesn't recognize <curl/curl.h>
:
1- hover over the error
2- click on Quick Fix, and go to Include Path settings
3- There you should see a line like One include path per line.
Write the path below it, and it will be recognized.
Of course, this is not necessary because you are using make
command to build, and it's just to prevent annoying editor errors.
4- after cloning this repo, there is a MakeFile in it, edit it and change the path:
to your own libcurl directory that you downloaded in step 3 (the path that contains include, lib ,etc files). For example, for me, it looks like (path := C:/libcurl).
Now, just run the make
command in the root folder (if it's not recognized, run it using the full path), and the executable the file named main
will be built.
if you couldnt run with make use g++ -std=c++17 -Wall resources/Game.cpp resources/GameHandler.cpp resources/MainProgram.cpp client.cpp -o compile/main -lcurl -pthread
if you have windows run this g++ -std=c++17 -Wall -IC:/libcurl/include resources/Game.cpp resources/GameHandler.cpp resources/MainProgram.cpp client.cpp -o compile/main -lcurl -LC:/libcurl/lib -lws2_32
and replace two C:/libcurl parts with your own libcurl path but it will take much more time
notice: for faster compilation you can use multiple cores of cpu for that use make -j4
and replace 4 with your max cores you want to use