A template CMake project to get you started with C++ and tooling

Overview

cpp_starter_project

codecov

Build Status

Build status

CMake

Getting Started

Use the Github template

First, click the green Use this template button near the top of this page. This will take you to Github's 'Generate Repository' page. Fill in a repository name and short description, and click 'Create repository from template'. This will allow you to create a new repository in your Github account, prepopulated with the contents of this project. Now you can clone the project locally and get to work!

$ git clone https://github.com/<user>/<your_new_repo>.git

Remove frameworks you're not going to use

If you know you're not going to use one or more of the optional gui/graphics frameworks (fltk, gtkmm, imgui, etc.), you can remove them with git rm:

$ git rm -r src/<unnecessary_framework>

Dependencies

Note about install commands:

  • for Windows, we use choco.
  • for MacOS, we use brew.
  • In case of an error in cmake, make sure that the dependencies are on the PATH.

Necessary Dependencies

  1. A C++ compiler that supports C++17. See cppreference.com to see which features are supported by each compiler. The following compilers should work:
  • gcc 7+

    Install command
    • Debian/Ubuntu:

        sudo apt install build-essential
      
    • Windows:

        choco install mingw -y
      
    • MacOS:

        brew install gcc
      
  • clang 6+

    Install command
    • Debian/Ubuntu:

        bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
      
    • Windows:

      Visual Studio 2019 ships with LLVM (see the Visual Studio section). However, to install LLVM separately:

        choco install llvm -y
      

      llvm-utils for using external LLVM with Visual Studio generator:

        git clone https://github.com/zufuliu/llvm-utils.git
        cd llvm-utils/VS2017
        .\install.bat
      
    • MacOS:

        brew install llvm
      
  • Visual Studio 2019 or higher

    Install command + Environment setup

    On Windows, you need to install Visual Studio 2019 because of the SDK and libraries that ship with it.

    Visual Studio IDE - 2019 Community (installs Clang too):

    choco install -y visualstudio2019community --package-parameters "add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --includeOptional --passive --locale en-US"
    

    Put MSVC compiler, Clang compiler, and vcvarsall.bat on the path:

    	choco install vswhere -y
    	refreshenv
    
    	# change to x86 for 32bit
    	$clpath = vswhere -products * -latest -prerelease -find **/Hostx64/x64/*
    	$clangpath = vswhere -products * -latest -prerelease -find **/Llvm/bin/*
    	$vcvarsallpath =  vswhere -products * -latest -prerelease -find **/Auxiliary/Build/*
    
    	$path = [System.Environment]::GetEnvironmentVariable("PATH", "User")
    	[Environment]::SetEnvironmentVariable("Path", $path + ";$clpath" + ";$clangpath" + ";$vcvarsallpath", "User")
    	refreshenv
    
  1. Conan

    Install Command
  2. CMake 3.15+

    Install Command
    • Debian/Ubuntu:

        sudo apt-get install cmake
      
    • Windows:

        choco install cmake -y
      
    • MacOS:

        brew install cmake
      

Optional Dependencies

C++ Tools

  • Doxygen

    Install Command
    • Debian/Ubuntu:

        sudo apt-get install doxygen
        sudo apt-get install graphviz
      
    • Windows:

        choco install doxygen.install -y
        choco install graphviz -y
      
    • MacOS:

        brew install doxygen
        brew install graphviz
      
  • ccache

    Install Command
    • Debian/Ubuntu:

        sudo apt-get install ccache
      
    • Windows:

        choco install ccache -y
      
    • MacOS:

        brew install ccache
      
  • Cppcheck

    Install Command
    • Debian/Ubuntu:

        sudo apt-get install cppcheck
      
    • Windows:

        choco install cppcheck -y
      
    • MacOS:

        brew install cppcheck
      
  • include-what-you-use

    Install Command

    Follow instructions here: https://github.com/include-what-you-use/include-what-you-use#how-to-install

GUI libraries

This project can be made to work with several optional GUI frameworks.

If desired, you should install the following optional dependencies as directed by their documentation, linked here:

The following dependencies can be downloaded automatically by CMake and Conan. All you need to do to install them is to turn on a CMake flag during configuration. If you run into difficulty using them, please refer to their documentation, linked here:

  • NANA
  • SDL
  • IMGUI: This framework depends on SFML, and if you are using Linux, you may need to install several of SFML's dependencies using your package manager. See the SFML build tutorial for specifics.

Build Instructions

Build directory

Make a build directory:

mkdir build

Specify the compiler using environment variables

By default (if you don't set environment variables CC and CXX), the system default compiler will be used.

Conan and CMake use the environment variables CC and CXX to decide which compiler to use. So to avoid the conflict issues only specify the compilers using these variables.

CMake will detect which compiler was used to build each of the Conan targets. If you build all of your Conan targets with one compiler, and then build your CMake targets with a different compiler, the project may fail to build.

Commands for setting the compilers
  • Debian/Ubuntu/MacOS:

    Set your desired compiler (clang, gcc, etc):

    • Temporarily (only for the current shell)

      Run one of the followings in the terminal:

      • clang

          CC=clang CXX=clang++
        
      • gcc

          CC=gcc CXX=g++
        
    • Permanent:

      Open ~/.bashrc using your text editor:

        gedit ~/.bashrc
      

      Add CC and CXX to point to the compilers:

        export CC=clang
        export CXX=clang++
      

      Save and close the file.

  • Windows:

    • Permanent:

      Run one of the followings in PowerShell:

      • Visual Studio generator and compiler (cl)

          [Environment]::SetEnvironmentVariable("CC", "cl.exe", "User")
          [Environment]::SetEnvironmentVariable("CXX", "cl.exe", "User")
          refreshenv
        

        Set the architecture using vsvarsall:

          vsvarsall.bat x64
        
      • clang

          [Environment]::SetEnvironmentVariable("CC", "clang.exe", "User")
          [Environment]::SetEnvironmentVariable("CXX", "clang++.exe", "User")
          refreshenv
        
      • gcc

          [Environment]::SetEnvironmentVariable("CC", "gcc.exe", "User")
          [Environment]::SetEnvironmentVariable("CXX", "g++.exe", "User")
          refreshenv
        
    • Temporarily (only for the current shell):

      	$Env:CC="clang.exe"
      	$Env:CXX="clang++.exe"
      

Configure your build

To configure the project and write makefiles, you could use cmake with a bunch of command line options. The easier option is to run cmake interactively:

Configure via cmake-gui:

  1. Open cmake-gui from the project directory:
cmake-gui .
  1. Set the build directory:

build_dir

  1. Configure the generator:

In cmake-gui, from the upper menu select Tools/Configure.

Warning: if you have set CC and CXX always choose the use default native compilers option. This picks CC and CXX. Don't change the compiler at this stage!

Windows - MinGW Makefiles

Choose MinGW Makefiles as the generator:

mingw
Windows - Visual Studio generator and compiler

You should have already set C and CXX to cl.exe.

Choose "Visual Studio 16 2019" as the generator:

default_vs
Windows - Visual Studio generator and Clang Compiler

You should have already set C and CXX to clang.exe and clang++.exe.

Choose "Visual Studio 16 2019" as the generator. To tell Visual studio to use clang-cl.exe:

  • If you use the LLVM that is shipped with Visual Studio: write ClangCl under "optional toolset to use".
visual_studio
  • If you use an external LLVM: write LLVM_v142 under "optional toolset to use".
visual_studio

  1. Choose the Cmake options and then generate:

generate

Configure via ccmake:

with the Cmake Curses Dialog Command Line tool:

ccmake -S . -B ./build

Once ccmake has finished setting up, press 'c' to configure the project, press 'g' to generate, and 'q' to quit.

Build

Once you have selected all the options you would like to use, you can build the project (all targets):

cmake --build ./build

For Visual Studio, give the build configuration (Release, RelWithDeb, Debug, etc) like the following:

cmake --build ./build -- /p:configuration=Release

Troubleshooting

Update Conan

Many problems that users have can be resolved by updating Conan, so if you are having any trouble with this project, you should start by doing that.

To update conan:

$ pip install --user --upgrade conan

You may need to use pip3 instead of pip in this command, depending on your platform.

Clear Conan cache

If you continue to have trouble with your Conan dependencies, you can try clearing your Conan cache:

$ conan remove -f '*'

The next time you run cmake or cmake --build, your Conan dependencies will be rebuilt. If you aren't using your system's default compiler, don't forget to set the CC, CXX, CMAKE_C_COMPILER, and CMAKE_CXX_COMPILER variables, as described in the 'Build using an alternate compiler' section above.

Identifying misconfiguration of Conan dependencies

If you have a dependency 'A' that requires a specific version of another dependency 'B', and your project is trying to use the wrong version of dependency 'B', Conan will produce warnings about this configuration error when you run CMake. These warnings can easily get lost between a couple hundred or thousand lines of output, depending on the size of your project.

If your project has a Conan configuration error, you can use conan info to find it. conan info displays information about the dependency graph of your project, with colorized output in some terminals.

$ cd build
$ conan info .

In my terminal, the first couple lines of conan info's output show all of the project's configuration warnings in a bright yellow font.

For example, the package spdlog/1.5.0 depends on the package fmt/6.1.2. If you were to modify the file cmake/Conan.cmake so that it requires an earlier version of fmt, such as fmt/6.0.0, and then run:

$ conan remove -f '*'       # clear Conan cache
$ rm -rf build              # clear previous CMake build
$ mkdir build && cd build
$ cmake ..                  # rebuild Conan dependencies
$ conan info .

...the first line of output would be a warning that spdlog needs a more recent version of fmt.

Testing

See Catch2 tutorial

Fuzz testing

See libFuzzer Tutorial

Comments
  • Cleanup static checks and code samples

    Cleanup static checks and code samples

    This has a few minor updates to apply what I think should be the default for best practices getting started C++ code:

    • sanitizers enabled by default
    • clang-tidy enabled by default
    • clang-format enabled as a github action

    Plus I tweaked a few of the clang-tidy warnings that are enabled to make them easier to work with and disable warnings that are google project specific.

    To do list:

    • [x] All gcc ENABLE_DEVELOPER_MODE=ON builds fail because the environment does not contain clang-tidy, so it fails at configure time
    • [x] Gcc / LLVM builds on Windows are actually still using MSVC, see here: https://github.com/cpp-best-practices/cpp_starter_project/runs/4991906918?check_suite_focus=true#step:5:63
    • [x] We might have too many builds in the matrix now? Something to consider.
    • [x] After we merge the required changes into project_options, we need to change the version of project_options linked in this branch.
    opened by lefticus 43
  • feat: make the build system reusable and declarative + support Vcpkg + automatically setup MSVC environment

    feat: make the build system reusable and declarative + support Vcpkg + automatically setup MSVC environment

    Fixes #125 Fixes #174 Fixes #40 Fixes #122

    This pull request makes the build system reusable by:

    • Making the Cmake files a Cmake library that is downloadable and reusable from multiple projects. https://github.com/aminya/ProjectOptions/

    • Removing the need for the copy-pasting 500 lines of CMake into different projects

    This makes the build system declarative and reproducible by:

    • Removing dynamic dependency injection
    • Removing unnecessarily Cmake options that can be instead declared

    All the options are exposed as function arguments and can be enabled/added by the user in a declarative way. Optionally there is a way to use global options.

    It also improves upon many of the CMake files. For example, support for Vcpkg is added now, vcvarsall automatically runs, MSVC address sanitizer now works, etc. See this for some of the improvements: https://github.com/aminya/ProjectOptions/releases

    See this for more information: https://github.com/cpp-best-practices/cpp_starter_project/issues/125#issuecomment-924479679

    enhancement needs-merge-approval 
    opened by aminya 31
  • Meta: add more repository maintainers

    Meta: add more repository maintainers

    I am opening this issue specifically because it seems that @lefticus is not able to review and merge all the pull requests, and so many of them are left open. One way to fix this is to add more maintainers to the repository.

    27 PRs are open at the moment https://github.com/lefticus/cpp_starter_project/pulls

    opened by aminya 16
  • Address Sanitizer broken on Windows

    Address Sanitizer broken on Windows

    Hi,

    i noticed that the CI-Builds from this template fail for Windows and MacOS when i enable the AddressSanitizer:

    CMakeLists.txt
    @@ -38,7 +38,7 @@ project_options(
          # ENABLE_USER_LINKER
          # ENABLE_BUILD_WITH_TIME_TRACE
          # ENABLE_UNITY
    -     # ENABLE_SANITIZER_ADDRESS
    +    ENABLE_SANITIZER_ADDRESS
          # ENABLE_SANITIZER_LEAK
          # ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
          # ENABLE_SANITIZER_THREAD
    

    I also noticed this behavior on my local machine on Visual Studio 2019 16.11.9 when enabling AddressSanitizer. Because this happens on CI and my machine i assume something is wrong with how the sanitizer is enabled through project_options? (I decided to open the issue here though as i would start searching here when running into this problem)

    I commited the above on my fork of the template: https://github.com/LtdSauce/cpp_starter_project See actions there for the failed builds. TL;DR: On Windows all executables fail with the following return Code 0xc0000135. That seems to happen when a dll cannot be loaded. On MacOS i have no clue what goes wrong as i never have worked with MacOS before.

    As i am not native to Windows i have no clue how to tackle this issue on my own... Has anyone run into this before and knows how to fix it?

    opened by LtdSauce 15
  • Build type other than RelWithDebInfo fails build on visual studio (multi config build)

    Build type other than RelWithDebInfo fails build on visual studio (multi config build)

    While playing around with the multi configuration generator for VisualStudio, i noticed that i cannot set the BUILD_TYPE to anything else than RelWithDebInfo. Because VisualStudios Generator sets the CMAKE_CONFIGURATION_TYPES to Debug;Release;MinSizeRel;RelWithDebInfo as it could handle multi-configurations. When conan is invoked the Cmake module iterates over CMAKE_CONFIGURATION_TYPES and installs the dependencies for them and puts the build-files and Find.cmake modules in the build directory. Because RelWithDebInfo is the last in the list, my build is only able to find the libraries for RelWithDebInfo... Trying to invoke the Debug configuration with cmake --build build --config Debug leads to errors like the following:

    docopt.lib(docopt.obj) : error LNK2038: Konflikt ermittelt für "_ITERATOR_DEBUG_LEVEL": Der Wert "0" stimmt nicht mit dem Wert "2" in main.obj überein. [C:\Users\ldetj\develop\EnCoDaTr\build-2\src \encodatr.vcxproj]

    Which looks like my Debug-Build is linked to the Libs from the RelWithDebInfo configuration. Is this a bug in the conan module from this project or have i misconfigured something? (I did a fresh configure on the project and build it with the command above)

    Could you or someone else try this aswell? (Do you need more information to reproduce?)

    I reproduced this with a github action by setting the BUILD_TYPE to Debug --> https://github.com/LtdSauce/cpp_starter_project/runs/4967074084?check_suite_focus=true.

    Initial Issue Description. This was just a symptom of the above issue and a deprecated CMake-Cache Hi,

    i'm not shure if i got an issue here or if it is just me beeing stupid.

    It seems that the default build type is not correctly set. When i configure a project created from the cpp-starter-project template and just configure it, i do not get the message "Setting build type to 'RelWithDebInfo' as none was specified." from StandardProjectSettings.cmake:3.

    I injected a message to check if those variables are already set to something:

    message(STATUS "Got CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}' or CMAKE_CONFIGURATION_TYPES: '${CMAKE_CONFIGURATION_TYPES}'")
    

    This got me the following message:

    [cmake] -- Got CMAKE_BUILD_TYPE: '' or CMAKE_CONFIGURATION_TYPE: 'Debug;Release;MinSizeRel;RelWithDebInfo'
    

    Because CMAKE_CONFIGURATION_TYPES is not empty the if evaluates to false and does not set a default for CMAKE_BUILD_TYPE. This later leads to the following error with conan:

    [cmake] -- Conan: Adding bincrafters remote repository (https://bincrafters.jfrog.io/artifactory/api/conan/public-conan) verify ssl (True)
    [cmake] -- Multi-configuration build: 'Debug;Release;MinSizeRel;RelWithDebInfo'!
    [cmake] -- Running Conan for build type 'Debug'
    [cmake] CMake Error at build/conan.cmake:71 (message):
    [cmake]   Please specify in command line CMAKE_BUILD_TYPE
    [cmake]   (-DCMAKE_BUILD_TYPE=Release)
    [cmake] Call Stack (most recent call first):
    [cmake]   build/conan.cmake:430 (_conan_detect_build_type)
    [cmake]   build/_deps/_project_options-src/src/Conan.cmake:39 (conan_cmake_autodetect)
    [cmake]   build/_deps/_project_options-src/src/Index.cmake:174 (run_conan)
    [cmake]   CMakeLists.txt:22 (project_options)
    

    By explicitly setting CMAKE_BUILD_TYPE the conan error is "fixed".

    EDIT: After doing a clean configure the conan error vanished. And i cannot reproduce it. The issue was due to the explanation from The second comment to this issue

    I'm on Windows 10 using the Visual Studio 2019 BuildTools with the MSVC Version 19.29.30037.0.

    Solution

    The error was caused by the generators in the conanfile.txt. cmake_find_package_multi was missing and the other generators just kept overwriting the find_packages of the previous BUILD_TYPE for the libs fetched from conan. By adding that generator and removing all the others the problem is fixed.

    opened by LtdSauce 12
  • Separate toolchain details from build system

    Separate toolchain details from build system

    If you really want to go the extra mile in providing a good example of how modern CMake should be used, it's arguably a good idea to avoid mentioning the details of tools and tool chains (e.g. specific analysers, package managers, compiler flags etc.) from within the CMakeLists.txt files. Those files should be reserved for describing how the source fits together to make binary artefacts.

    The root CMakeLists.txt in particular is doing double duty as a script for enabling many, varied workflows. They could mostly/all be removed from CMake, or isolated into .cmake files which aren't invoked from CMakeLists.txt but are instead invoked using cmake in script mode. The ideal is achieving a clean separation between the build system and the other tools on display in this project.

    Examples:

    • All of the compiler options could be passing in via the cmake configuration command (e.g. using the language flags variables) or collected into toolchain files (example, more explanation). This makes it easier to add or extend tool chain support.
    • The build system could be made package manager-agnostic by removing all reference to Conan. A clean separation is generally encourage by the Conan team, and it's straightforward to achieve using generators such as cmake_find_package.
    • Tools like Clang-Tidy can be enabled from outside the CMakeLists.txt files for cleaner separation.

    In general, if a variable starts with CMAKE_, then it's ideally passed into the build system, rather than set from inside of it.

    wontfix 
    opened by johnmcfarlane 12
  • WIP Feature/add non root user in dev container

    WIP Feature/add non root user in dev container

    Make docker dev container safer to use by logging to a non-root user as described here https://aka.ms/vscode-remote/containers/non-root . Clean up some defaulted arguments. Install cmake_format in the container

    opened by Jason5480 11
  • Have built binaries be generated to 'build/bin/' instead of 'build/src/'

    Have built binaries be generated to 'build/bin/' instead of 'build/src/'

    I find it annoying/confusing that the binaries are generated in builtd/src.

    I'm suggesting a (very!) simple change to have it output to build/bin which makes more sense and should be easier to grasp for newcomers and beginners.

    opened by ShadowMitia 11
  • Catch2 not found: case-insensitive filesystem

    Catch2 not found: case-insensitive filesystem

    On macOS: When I do mkdir build-cpp_starter_project && cd build-cpp_starter_project && cmake ../cpp_starter_project I get

    ...
    ERROR: Requested 'catch2/2.11.0' but found case incompatible 'Catch2'
    Case insensitive filesystem can't manage this
    CMake Error at /Users/benfrantzdale/code/other/build-cpp_starter_project/conan.cmake:402 (message):
      Conan install failed='1'
    Call Stack (most recent call first):
      /Users/benfrantzdale/code/other/build-cpp_starter_project/conan.cmake:497 (conan_cmake_install)
      cmake/Conan.cmake:16 (conan_cmake_run)
      CMakeLists.txt:65 (run_conan)
    

    If I delete my ~/.conan directory, it builds, but then when I go to make I get

     $ make
    Scanning dependencies of target catch_main
    [ 10%] Building CXX object test/CMakeFiles/catch_main.dir/catch_main.cpp.o
    In file included from /Users/benfrantzdale/code/other/cpp_starter_project/test/catch_main.cpp:3:
    /Users/benfrantzdale/.conan/data/catch2/2.11.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/catch2/catch.hpp:482:63: error: expected ';' at end of declaration list
            SourceLineInfo( char const* _file, std::size_t _line ) noexcept
                                                                  ^
    ...
    /Users/benfrantzdale/.conan/data/catch2/2.11.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/catch2/catch.hpp:640:63: error: expected ';' at end of declaration list
            auto substr( size_type start, size_type length ) const noexcept -> StringRef;
                                                                  ^
    /Users/benfrantzdale/.conan/data/catch2/2.11.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/catch2/catch.hpp:643:9: error: 'auto' not allowed in function return type
            auto data() const noexcept -> char const*;
            ^~~~
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    make[2]: *** [test/CMakeFiles/catch_main.dir/catch_main.cpp.o] Error 1
    make[1]: *** [test/CMakeFiles/catch_main.dir/all] Error 2
    make: *** [all] Error 2
    $
    

    which makes it look like it's trying to build catch2 but isn't in C++17 mode. FWIW, https://github.com/bugwelle/cpp-starter-project works (and is why my Conan had Catch2).

    opened by BenFrantzDale 11
  • Feature/cross ide cmake presets

    Feature/cross ide cmake presets

    As discussed with @ddalcino in #161 It would be nice to have a cross IDE project configuration. Now this is available through CMakePresets.json file. A relative new CMake feature introduced in version 3.19 and it is already usable by VS2022 and VSCode and CLion(not tested) in version 3.21. QtCreator will follow soon! I can verify that this work in Windows PC:

    • using Visual Studio 2022 and msvc compiler in Local machine
    • using Visual Studio 2022 and a WSL Ubuntu18.04, Ubuntu20.04 with both gcc and clang
    • using VS Code and msvc compiler in Local machine
    • using VS Code and the Docker image provided in this repo Ubuntu18.04 both with gcc and clang

    It would be nice if a Linux user with CLion and VSCode installe can also verify that this work as expected (@lefticus :))

    • [x] In his Local machine using both gcc and clang in VS Code
    • [x] In his Local machine using both gcc anf clang in CLion (probably more vendor specific options are needed as described here.
    • [x] using VSCode and the Docker image gcc and clang
    • [x] any other inception concept

    Also it would be nice to have some feedback (input and thoughts) from @midnightexigent and @shreyasbharath who implemented #60 and #99 and have experience with VSCode and Docker.

    EDIT: Dockerfile is updated to also support ubuntu focal and the most recent gcc and clang versions (always configurable when build the image). New ${VARIANT} equal to [bionic, focal] should do the job like GCC_VER, LLVM_VER and USE_CLANG

    opened by Jason5480 9
  • Test using setup-python directly for common packages

    Test using setup-python directly for common packages

    • gcovr, conan, ninja, cmake are all fully supported with pip install on all 3 platforms
    • using setup-python and pip3 directly removes one variable from the build process
    • using pip3 directly to install all 3 provides consistency across platforms
    opened by lefticus 8
  • How to change LSAN variables

    How to change LSAN variables

    Hello, I'm trying to do some stuff with this template as base, and I have some leaks, but I don't know how to set the variables on this project.

    ==86737==LeakSanitizer has encountered a fatal error.
    ==86737==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
    ==86737==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
    

    My knowledge on CMake is not so big, and this template is not so easy to use.

    opened by parequena 1
  • Error with CLI library

    Error with CLI library

    I get this error when trying to build the project:

    [2/2] Linking CXX executable src/intro
    FAILED: src/intro
    : && /usr/bin/c++ -O2 -g -DNDEBUG -fsanitize=address,leak,undefined src/CMakeFiles/intro.dir/main.cpp.o -o src/i
    d9a98f4c14b042a0cc7d6c663f5/lib/libspdlog.a  /home/obm/.conan/data/fmt/8.1.1/_/_/package/0dab009e164b61a28f957a6
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o: warning: relocation against `_ZTVN3CLI10ConfigBaseE' in read-o
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o:(.data.rel+0x558): undefined reference to `typeinfo for CLI::Co
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o:(.data.rel+0x5b8): undefined reference to `typeinfo for CLI::Co
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o:(.data.rel+0x618): undefined reference to `typeinfo for CLI::Co
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o:(.data.rel+0x678): undefined reference to `typeinfo for CLI::Co
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o:(.data.rel+0x6d8): undefined reference to `typeinfo for CLI::Co
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o:(.data.rel+0x738): more undefined references to `typeinfo for C
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o:(.data.rel+0x1638): undefined reference to `typeinfo for CLI::F
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o:(.data.rel+0x1698): undefined reference to `typeinfo for CLI::C
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o:(.data.rel+0x1cf8): undefined reference to `typeinfo for CLI::C
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o:(.data.rel+0x1d58): undefined reference to `typeinfo for CLI::F
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o: in function `CLI::ConfigBase::ConfigBase()':
    /home/obm/.conan/data/cli11/2.2.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/CLI/ConfigFwd.hpp
    /usr/bin/ld: /home/obm/.conan/data/cli11/2.2.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/CLI/
    /usr/bin/ld: /home/obm/.conan/data/cli11/2.2.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/CLI/
    /usr/bin/ld: src/CMakeFiles/intro.dir/main.cpp.o: in function `CLI::Formatter::Formatter()':
    /home/obm/.conan/data/cli11/2.2.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/CLI/FormatterFwd.
    /usr/bin/ld: /home/obm/.conan/data/cli11/2.2.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/CLI/
    /usr/bin/ld: /home/obm/.conan/data/cli11/2.2.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/CLI/
    /usr/bin/ld: warning: creating DT_TEXTREL in a PIE
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    

    Also, I am new to C++. Every time I build, will I run the build.sh script? Or is there a faster way to build?

    opened by FillePiano 0
  • Conan error sdl/2.0.20

    Conan error sdl/2.0.20

    On a fresh clone I get the following error:

     Developer mode is ON. For production, use `-DENABLE_DEVELOPER_MODE:BOOL=OFF`. Building the project for the
     developer...
     The default CMAKE_C_STANDARD used by external targets and tools is not set yet. Using the latest supported C
     standard that is 17
     Interprocedural optimization is enabled. In other projects, linking with the compiled libraries of this
     project might require `set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)`
     /usr/bin/ccache found and enabled
     Conan: Adding cci remote repository (https://center.conan.io) verify ssl (True)
     Conan: Adding bincrafters remote repository (https://bincrafters.jfrog.io/artifactory/api/conan/public-conan)
     verify ssl (True)
     Single configuration build!
     Running Conan for build type 'RelWithDebInfo'
     Conan: checking conan executable
     Conan: Found program /usr/bin/conan
     Conan: Version found Conan version 1.50.0
     Conan executing: /usr/bin/conan install /home/obm/programs/setgamus --build missing --env CC=/usr/bin/cc
     --env CXX=/usr/bin/c++ --settings build_type=RelWithDebInfo --settings compiler=gcc --settings
     compiler.version=12 --settings compiler.libcxx=libstdc++11 --settings compiler.cppstd=20
     ERROR: sdl/2.0.20: Cannot load recipe.
     Error loading conanfile at '/home/obm/.conan/data/sdl/2.0.20/_/_/export/conanfile.py': Unable to load
     conanfile in /home/obm/.conan/data/sdl/2.0.20/_/_/export/conanfile.py
       File "/usr/lib/python3.10/imp.py", line 172, in load_source
         module = _load(spec)
       File "<frozen importlib._bootstrap>", line 719, in _load
       File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
       File "<frozen importlib._bootstrap_external>", line 883, in exec_module
       File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
       File "/home/obm/.conan/data/sdl/2.0.20/_/_/export/conanfile.py", line 3, in <module>
         from conan.tools.apple import is_apple_os
     ImportError: cannot import name 'is_apple_os' from 'conan.tools.apple'
     (/usr/lib/python3.10/site-packages/conan/tools/apple/__init__.py)
    
     CMake Error at build/conan.cmake:638 (message):
       Conan install failed='1'
     Call Stack (most recent call first):
       build/_deps/_project_options-src/src/Conan.cmake:61 (conan_cmake_install)
       build/_deps/_project_options-src/src/Index.cmake:212 (run_conan)
       build/_deps/_project_options-src/src/DynamicProjectOptions.cmake:147 (project_options)
       CMakeLists.txt:100 (dynamic_project_options)
    
     Configuring incomplete, errors occurred!
     See also "/home/obm/programs/setgamus/build/CMakeFiles/CMakeOutput.log".
    

    Any ideas? It works if I delete all references to sdl (also in the conanfile).

    opened by FillePiano 0
  • why a template, want to clone to my machine

    why a template, want to clone to my machine

    Making this project a template just seems like a way to force someone to have a github account. Why?? Of course I have a github account otherwise I wouldn't be able to make this comment. I'm sick of every site on the internet wanting me to have a damn account. Every EULA signed lets companies sell any information they can find out about you. So this is my push back. To clone this and other github templates off the github platform (say to your own machine) google: "clone github template" and follow the "[Is it possible to create a new git repository from a template]" link. I finished after the 'git commit -m "First commit" ' bullet. You will find gui_starter_template.git exists under the cpp-best-practices folder. Is there are better way to circumvent github templates? One good way would be for contributors NOT to use templates.

    opened by doug-gilbert 1
  • Failing configuration with VS 2017

    Failing configuration with VS 2017

    I tried to configure the template with Conan 1.52.0, CMake 3.24.1 and VS 2017 locally, but failed:

    CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.24/Modules/FetchContent.cmake:1264 (message):
      The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
      not set.  The policy's OLD behavior will be used.  When using a URL
      download, the timestamps of extracted files should preferably be that of
      the time of extraction, otherwise code that depends on the extracted
      contents might not be rebuilt if the URL changes.  The OLD behavior
      preserves the timestamps from the archive instead, but this is usually not
      what you want.  Update your project to the NEW behavior or specify the
      DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
      robustness issue.
    Call Stack (most recent call first):
      CMakeLists.txt:26 (FetchContent_Declare)
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19043.
    Developer mode is ON. For production, use `-DENABLE_DEVELOPER_MODE:BOOL=OFF`. Building the project for the developer...
    The default CMAKE_C_STANDARD used by external targets and tools is not set yet. Using the latest supported C standard that is 11
    Running `C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsall.bat x64` to set up the MSVC environment
    Conan: Adding cci remote repository (https://center.conan.io) verify ssl (True)
    Conan: Adding bincrafters remote repository (https://bincrafters.jfrog.io/artifactory/api/conan/public-conan) verify ssl (True)
    Multi-configuration build: 'Debug;Release;RelWithDebInfo;MinSizeRel'!
    Running Conan for build type 'Debug'
    Conan: Detected VS runtime: MDd
    Conan: checking conan executable
    Conan: Found program C:/Python37/Scripts/conan.exe
    Conan: Version found Conan version 1.52.0
    Conan executing: C:/Python37/Scripts/conan.exe install C:/Projects/gui_starter_template --build missing --env CC=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe --env CXX=C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe --settings arch=x86_64 --settings build_type=Debug --settings compiler=Visual Studio --settings compiler.version=15 --settings compiler.runtime=MDd --settings compiler.cppstd=20
    CMake Error at C:/Users/USER/.conan/data/fmt/8.1.1/_/_/build/67647ff867def3ba6e3c8fcf23f3b0612ab98b8d/build/generators/conan_toolchain.cmake:13 (message):
    
      The 'CMakeToolchain' generator only works with CMake >= 3.15
    Call Stack (most recent call first):
      C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.12/Modules/CMakeDetermineSystem.cmake:94 (include)
      CMakeLists.txt:66 (project)
    
    
    
    fmt/8.1.1: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    fmt/8.1.1: ERROR: Package '67647ff867def3ba6e3c8fcf23f3b0612ab98b8d' build failed
    fmt/8.1.1: WARN: Build folder C:\Users\USER\.conan\data\fmt\8.1.1\_\_\build\67647ff867def3ba6e3c8fcf23f3b0612ab98b8d\build
    ERROR: fmt/8.1.1: Error in build() method, line 84
    	cmake.configure()
    	ConanException: Error 1 while executing cmake -G "Visual Studio 15 2017" -DCMAKE_TOOLCHAIN_FILE="C:/Users/USER/.conan/data/fmt/8.1.1/_/_/build/67647ff867def3ba6e3c8fcf23f3b0612ab98b8d/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/USER/.conan/data/fmt/8.1.1/_/_/package/67647ff867def3ba6e3c8fcf23f3b0612ab98b8d" -DFMT_DOC="OFF" -DFMT_TEST="OFF" -DFMT_INSTALL="ON" -DFMT_LIB_DIR="lib" -DFMT_OS="ON" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "C:\Users\USER\.conan\data\fmt\8.1.1\_\_\build\67647ff867def3ba6e3c8fcf23f3b0612ab98b8d\src"
    
    CMake Error at win64/conan.cmake:638 (message):
      Conan install failed='1'
    Call Stack (most recent call first):
      win64/_deps/_project_options-src/src/Conan.cmake:61 (conan_cmake_install)
      win64/_deps/_project_options-src/src/Index.cmake:212 (run_conan)
      win64/_deps/_project_options-src/src/DynamicProjectOptions.cmake:147 (project_options)
      CMakeLists.txt:100 (dynamic_project_options)
    
    
    Configuring incomplete, errors occurred!
    See also "C:/Projects/gui_starter_template/win64/CMakeFiles/CMakeOutput.log".
    
    opened by tbeu 0
Owner
Jason Turner
Host of C++ Weekly YouTube series, co-host of CppCast C++ podcast.
Jason Turner
A template for modern C++ projects using CMake, Clang-Format, CI, unit testing and more, with support for downstream inclusion.

Modern C++ Template A quick C++ template for modern CMake projects, aimed to be an easy to use starting point. This is my personal take on such a type

Filip Dutescu 1.2k Jan 5, 2023
Blitz++ is a C++ template class library which provides array objects for scientific computing

Blitz++ is a C++ template class library which provides array objects for scientific computing

Peter Kümmel 17 Nov 22, 2020
Pitchfork is a Set of C++ Project Conventions

Pitchfork Pitchfork is a set of conventions for native C and C++ projects. The most prominent being the project layout conventions. The layout specifi

null 804 Jan 2, 2023
Starter project for cross platform WebGPU development in C++

A starter code for cross-platform (i.e., web & native) C++ WebGPU projects.

Will Usher 30 Dec 7, 2022
Arduino sample code to help you get started using the Soracom IoT Starter Kit!

Soracom IoT Starter Kit The Soracom IoT Starter Kit includes everything you need to build your first connected device. It includes an Arduino MKR GSM

Soracom Labs 13 Jul 30, 2022
This project is pretty straightforward, you have to recode printf. You will learn what is and how to implement variadic functions. Once you validate it, you will reuse this function in your future projects.

100/100 Introduction to ft_printf This is the third project in the 1337 Curriculum #42network . This project is pretty straight forward, recode the pr

Zakaria Yacoubi 4 May 27, 2022
Learn how to connect your Flexispot (LoctekMotion) desk to the internet. This repository contains a collection of scripts to get your started, combined with research and instructions.

(image source: Windows Central) Turn your LoctekMotion/FlexiSpot desk into a smart desk Recently I acquired a new standing desk from FlexiSpot. During

Mick Vleeshouwer 216 Dec 28, 2022
A repo for helping people get started with Competitive Programming and Data Structures & Algorithms

Hack CP DSA Update regarding hacktoberfest: please refer this announcement Wanna improve your problem solving skills ❓ Wanna practice collaborating on

TLE MEC 177 Dec 21, 2022
Simple, fast, easy to get started mid-level game engine written in Zig

Alka Game engine written in zig, compatible with master branch. This engine does provide a toolset for you but generally you have to implement how the

Kiakra 23 Dec 5, 2022
Lets be creative this hacktober fest. Get started with contributing to open source.

Be Creative this Hacktoberfest 2021 Lets be creative this hacktober fest. Get started with contributing to open source. ?? Web-Ideas ?? How Can I Cont

B L A C K F U R Y 17 Oct 31, 2022
This repo is for competitive coders. In the readme file you will get the list of questions. You can contribute by adding your solutions or by providing the optimized solutions which are answered already.

Hello, Problem Solvers !!! ?? What it's about? ??‍?? This repository is for Competitive Coders to get started with Open-source. ?? We have curated a l

null 3 Oct 22, 2022
This is a fork of prboom+ with extra tooling for demo recording and playback, with a focus on speedrunning.

dsda-doom v0.15.1 This is a fork of prboom+ with extra tooling for demo recording and playback, with a focus on speedrunning. Heretic Support (beta) D

Ryan Krafnick 135 Jan 8, 2023
Local OXID Resolver (LCLOR) : Research and Tooling

hazmat5 Local OXID Resolver (LCLOR) : Research and Tooling Welcome to a repository on my research into DCOM's Local OXID Resolution mechanisms, and RP

Alex Ionescu 28 Oct 26, 2022
Tooling and Scripts for Hacking Super Street Fighter II Cabinets

sf-cabinet Tools and utilities for modifying SF2 Cabinets What This repository contains research and tooling around the mini Street Fighter 2 cabinet

wrongbaud 14 Oct 29, 2022
3DO M2 Portfolio OS v3.0 and tooling source dump

3DO M2 Portfolio OS v3.0 The 3DO Opera platform ran an OS called Portfolio. Developed internally at NTG/3DO by several of the same people who develope

null 16 Jan 5, 2023
Get Next Line is a project at 42. It is a function that reads a file and allows you to read a line ending with a newline character from a file descriptor

Get Next Line is a project at 42. It is a function that reads a file and allows you to read a line ending with a newline character from a file descriptor. When you call the function again on the same file, it grabs the next line

Mhamed Ajjig 5 Nov 15, 2022
Bear is a tool that generates a compilation database for clang tooling.

ʕ·ᴥ·ʔ Build EAR Bear is a tool that generates a compilation database for clang tooling. The JSON compilation database is used in the clang project to

László Nagy 3.2k Jan 9, 2023
Some hypervisor research notes. There is also a useful exploit template that you can use to verify / falsify any assumptions you may make while auditing code, and for exploit development.

Introduction Over the past few weeks, I've been doing some hypervisor research here and there, with most of my focus being on PCI device emulation cod

Faith 130 Nov 18, 2022
this is a repo of where you will get to see tic tac toe AI intregrated project

?? Tic-Tac-Toe-AI-Intregrated ?? What is the meaning of AI Intregrated ??‍♀️ ??‍♂️ ❓ ❓ You all have Played Tic Tac Toe in your life if you don't know

Ujjwal 18 Dec 5, 2022
Now get your alerts & updates about home, wherever you are, with an SMS on your mobile! All with a simple NodeMCU project!

Now get your alerts & updates about home, wherever you are, with an SMS on your mobile! All with a simple NodeMCU project!

Priyanka Peddinti 2 Oct 20, 2021