GithubHelp home page GithubHelp logo

mzdun / cxx-exercise Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 22 KB

Template for the C++ exercise

Home Page: https://api.csswg.org/bikeshed/?force=1&url=https://raw.githubusercontent.com/mzdun/cxx-exercise/master/docs/spec.bs

License: MIT License

CMake 15.68% C++ 84.32%

cxx-exercise's Introduction

C++ exercise

This is a template for the C++ exercise. You can either fork it to your GitHub and then clone it, or clone it directly from here.

Getting the code

The tests are written using GTest environment, which is attached as a submodule to this repo. With Git 1.6.5 and later, you can clone the exercise and Google Test in one step:

git clone --recursive https://github.com/mzdun/cxx-exercise.git

Prior to that, to get the submodules, you must call submodule update by hand:

git clone https://github.com/mzdun/cxx-exercise.git
cd cxx-exercise
git submodule update --init --recursive

Building and running tests

CMake supports out-of-directory builds, which I strongly recommend. They keep the objects file away from the source code and cleaning the project and removing the build directory are almost the same operations.

mkdir build
cd build
cmake ..

CMake will use the best guess as to which compiler to use. On Windows it will consult registry and target newest Visual Studio/MSBuild combo. On Linux, it will use the cc and c++ programs. In case you are not happy with the results of c++ --version, you can force the compiler with CC and CXX environment variables. E.g. on Linux, where the shells support ad-hoc environment setting, you can force GCC 9 replacing the last line of the code above with:

CC=gcc-9 CXX=g++-9 cmake ..

Once the CMake finishes the configuration, it should leave you with set of build files. On Windows it will create a Visual Studio solution, cxx-exercise.sln and a .vcxproj for each target. On Linux it will create quite a number of Makefile files, so you can build and run the tests with:

make && ./tests/tests

Further reading

Further information, including the text of the exercise itself, can be found in the docs (raw file).

cxx-exercise's People

Contributors

mzdun avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.