How do I install a Windows program (written in C) downloaded from GitHub?

You look around and find the installer on the release page. Sure you could compile the source, but I don't think that's what you want.


.c and .h files are C source code.

You will need to install a C compiler such as Visual Studio, tcc or something similar, load the project and then compile it to run it.

Failing that, the project has a release page (here) that will give you access to a pre-compiled version to save you time and effort.


Github is primarily used by programmers to collaborate on projects. The 'Download ZIP' option downloads a copy of the source code to your computer. This usually1 doesn't contain a copy of the compiled usable executables/binaries (ie; exe files)

Releases, is a Github feature for shipping software to end users (who usually aren't interested in the actual coding). Releases are accompanied by release notes and links to download the software or source code. This is the first place you should check for binaries.

In your case, the releases page offers downloads and setup files.

However, many projects won't have any releases (especially not for Windows), in which case you can do one of the following:

  1. Search for binaries elsewhere on the internet. Usually search engines like DuckDuckGo (or Google, if you prefer) will find what you want easily. Try searching for <application name> for Windows or <application name> exe.

  2. Compile it yourself. You need to have at least some basic knowledge of the programming language to be able to do so. Here again, search engines can be massively helpful. Try searching for compile <application name> on Windows or MinGW compile <application name>.

    Here I'll run through the basics of compiling utilities for Widnows:

    • Download MinGW. I personally favor this package because it comes with boost (which several applications use) and a cool shell. It also comes with git, which can be super useful if you want to compile files hosted on Github or other Git version control repositories without having to separately download the source.

    • Run the following commands in cmd or powershell:

      • cd c:\sources\hello: Change the directory to wherever it is that the source file(s) is/are located.
      • g++ helloworld.cpp -o helloworld.exe: here helloworld.cpp is the name of the main source file, and helloworld.exe is the name of the compiled executable.
      • In case you have to compile multiple files list them before the -o switch: g++ helloworld.cpp foo.cpp -o helloworld.exe
      • These are the instructions for C++. If you're dealing with applications programmed in C, the file extension will be .c instead of .cpp, and you should use the gcc command instead of g++. The rest is more or less identical
      • Note that you may need to specify more command line arguments in order to compile an executable which works properly. The project page will usually have these details.
      • You also probably definitely want to look into makefiles. This Stack Overflow post is about makefiles in general, and this one tells us how to use them with MinGW. If a project comes with a makefile, try it before manually compiling the source.
      • You should now be able to run helloworld.exe.
    • Note: Most projects come with a README file. Please do what the name implies, these files contain important information regarding compiling and running software and by reading it you can avoid a lot of unnecessary hassle.

1Note: Sometimes there may be a folder called bin among the downloaded files, which should contain usable executables/binaries

Also see Cygwin and GOW if you want GNU/Linux command line utilities on Windows. I make some the latest version of some useful executables available for download here.

Further reading:
http://www.mingw.org/wiki/MinGW_for_First_Time_Users_HOWTO
https://gcc.gnu.org/onlinedocs/index.html#dir
https://stackoverflow.com/questions/22873884/how-do-i-run-configure-with-mingw

Tags:

C

Windows 7