Skip to content

Instantly share code, notes, and snippets.

@jamiely
Created May 15, 2021 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamiely/731a952a989d593a937b98d1788daf01 to your computer and use it in GitHub Desktop.
Save jamiely/731a952a989d593a937b98d1788daf01 to your computer and use it in GitHub Desktop.
Error without guards
cmake -S . -B build && cmake --build build && (cd build && ctest --output-on-failure)
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jamiely/code/tmp/cpp_chess_bot/build
Consolidate compiler generated dependencies of target gtest
[ 5%] Built target gtest
Consolidate compiler generated dependencies of target gtest_main
[ 11%] Built target gtest_main
Consolidate compiler generated dependencies of target board_test
[ 13%] Building CXX object CMakeFiles/board_test.dir/tests/board_test.cpp.o
In file included from /Users/jamiely/code/tmp/cpp_chess_bot/tests/board_test.cpp:3:
In file included from /Users/jamiely/code/tmp/cpp_chess_bot/src/BoardRenderer.h:2:
/Users/jamiely/code/tmp/cpp_chess_bot/src/board.h:8:7: error: redefinition of 'Board'
class Board {
^
/Users/jamiely/code/tmp/cpp_chess_bot/tests/board_test.cpp:2:10: note: '/Users/jamiely/code/tmp/cpp_chess_bot/src/board.h'
included multiple times, additional include site here
#include "board.h"
^
/Users/jamiely/code/tmp/cpp_chess_bot/src/BoardRenderer.h:2:10: note: '/Users/jamiely/code/tmp/cpp_chess_bot/src/board.h' included
multiple times, additional include site here
#include "board.h"
^
/Users/jamiely/code/tmp/cpp_chess_bot/src/board.h:8:7: note: unguarded header; consider using #ifdef guards or #pragma once
class Board {
^
In file included from /Users/jamiely/code/tmp/cpp_chess_bot/tests/board_test.cpp:3:
In file included from /Users/jamiely/code/tmp/cpp_chess_bot/src/BoardRenderer.h:2:
/Users/jamiely/code/tmp/cpp_chess_bot/src/board.h:22:8: error: redefinition of 'Move'
struct Move {
^
/Users/jamiely/code/tmp/cpp_chess_bot/tests/board_test.cpp:2:10: note: '/Users/jamiely/code/tmp/cpp_chess_bot/src/board.h'
included multiple times, additional include site here
#include "board.h"
^
/Users/jamiely/code/tmp/cpp_chess_bot/src/BoardRenderer.h:2:10: note: '/Users/jamiely/code/tmp/cpp_chess_bot/src/board.h' included
multiple times, additional include site here
#include "board.h"
^
/Users/jamiely/code/tmp/cpp_chess_bot/src/board.h:22:8: note: unguarded header; consider using #ifdef guards or #pragma once
struct Move {
^
2 errors generated.
make[2]: *** [CMakeFiles/board_test.dir/tests/board_test.cpp.o] Error 1
make[1]: *** [CMakeFiles/board_test.dir/all] Error 2
make: *** [all] Error 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment