/ansi-c

The exercises are taken from the book "The C Programming Language"

Primary LanguageCMIT LicenseMIT

ANSI C

Build Status License Hits-of-Code

The exercises are taken from the book The C Programming Language.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

  • TinyCC
  • CMake
  • Make or NMake

Installing

Check your software for your operating system.

Linux

You should install TCC. For example, you will enter the following command in terminal if you use package manager pacman:

$ sudo pacman -S tcc

To check version of TCC enter $ tcc -vv in terminal. The output of the command would be something like this:

tcc version 0.9.27 (x86_64 Linux)
install: /usr/lib/tcc
include:
  /usr/lib/tcc/include
  /usr/local/include
  /usr/include
libraries:
  /usr/lib64
  /lib64
  /usr/local/lib64
libtcc1:
  /usr/lib/tcc/libtcc1.a
crt:
  /usr/lib64
elfinterp:
  /lib64/ld-linux-x86-64.so.2

You should install CMake. For example, you will enter the following command in terminal if you use package manager pacman:

$ sudo pacman -S cmake

To check version of CMake enter $ cmake --version in terminal. The output of the command would be something like this:

cmake version 3.14.5

CMake suite maintained and supported by Kitware (kitware.com/cmake).

You should install Make. For example, you will enter the following command in terminal if you use Arch Linux:

$ sudo pacman -S base-devel

But, you should enter other command in terminal if you want to install Make directly:

$ sudo pacman -S make

To check version of Make enter $ make --version in terminal. The output of the command would be something like this:

GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Windows

You should install TCC. You can download binary from TCC offical site and install it. After installation TCC you should add a path to tcc.exe to the system variable PATH. To check version of TCC enter > tcc -vv in command prompt. The output of the command would be something like this:

tcc version 0.9.27 (x86_64 Windows)
install: c:/tcc
include:
  c:/tcc/include
  c:/tcc/include/winapi
libraries:
  c:/tcc/lib
  C:/WINDOWS/system32
libtcc1:
  c:/tcc/libtcc1-64.a

You should install CMake. You can download binary from CMake offical site and install it. After installation CMake you should add a path to cmake.exe to the system variable PATH. To check version CMake enter > cmake --version in command prompt. The output of the command would be something like this:

cmake version 3.15.0-rc2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

You should install NMake. The Microsoft Program Maintenance Utility (NMAKE.EXE) is a command-line tool included with Visual Studio ... So, you can download the Visual Studio Community and install it. After installation Visual Studio Community you may install only MSVC component. Now, you should open Developer Command Prompt for example, x86_64 Cross Tools Command Prompt for VS 2019. To see help for NMake enter > nmake /? in the opened command prompt. The output of the command would be something like this:

Microsoft (R) Program Maintenance Utility Version 14.21.27702.2
Copyright (C) Microsoft Corporation.  All rights reserved.

Usage:  NMAKE @commandfile
        NMAKE [options] [/f makefile] [/x stderrfile] [macrodefs] [targets]

Options:
...

Deployment

After fetch this repository create following folders at the same level:

Linux

Pass into the folder build. Type the following command in terminal to generate files for Make:

$ cmake ../ansi-c

Type the following command in terminal to build from Makefile:

$ make
Windows

Open Developer Command Prompt for example, x86_64 Cross Tools Command Prompt for VS 2019. Pass into the folder build from opened command prompt. Type the following command in terminal to generate files for NMake:

> cmake ..\ansi-c -G "NMake Makefiles"

Type the following command in terminal to build from Makefile:

> nmake

Now, you can find executable files in the folder bin.

Built With

Author

  • Alexandr Rihtarich - Initial work - Rihtarich

License

This project is licensed under the MIT License - see the LICENSE.md file for details