Tutorials/Compiling

Ah, so you've downloaded a search software but don't know what to do with that jumble of code. For this example, we will use gfind

Getting Cygwin for Windows Users

Skip this section if you're using a Unix-compatible system.

Before you dive into compiling and you don't have a Unix-ish command line, you'll want to download Cygwin, the 64 bit one, click that link and then open the installer. While in the setup for packages, make sure to select the gcc-g++ and make and include their dependencies when asked.

Next you want to make a folder for your stuff. For this, make a folder in your C:\cygwin64\home\YourUsername folder (Where YourUsername is whatever username you use on your PC), let's call it C, and make a folder for the program in the C folder called gfind. Now put your gfind.c file there. Now moving on!

Compiling the Code

Now we can actually compile. In the terminal, type in the following:

cd /C/gfind

You should now see a yellow little thing that says "~/gfind", this means you are in the folder. Now, to compile, type:

gcc -O3 -o gfind gfind.c

It will pause for a while, there might be some warnings, but don't worry. After the command line comes back... done! You've compiled gfind. To use it, do

./gfind

You can do this for any other C program, just replace gfind with the program (e.g. zfind). Some programs have different commands for compilation, those commands are usually available in the README.

Examples you can try

gollark: It might be eventually if better power generation or something else allows dirt-cheap desalination.
gollark: If we had vast quantities of convenient water just sitting right where people need it would be unreasonable rent-seeking to charge for it, but distribution and extraction of it isn't trivial.
gollark: Or, practically, different amounts of each.
gollark: So you can choose to buy water or not-water.
gollark: Like I said, I also support UBI or similar "free money" policies.
This article is issued from Conwaylife. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.