0

I'm trying to build a simple project using biicode , including the catch cpp unit test library. For now I've a simple vanilla project with no extra declarations , looks something like

#define CATCH_CONFIG_MAIN 
#include "catch.hpp"
#include "cbs-algorithm-sort.hpp"

int returnInt(int n){ return n; };

TEST_CASE( "Sample test", "[Sample Test]" ) {
    REQUIRE( returnInt(1) == 1 );
    REQUIRE( returnInt(2) == 2 );
    REQUIRE( returnInt(3) == 6 );
    REQUIRE( returnInt(10) == 3628800 );
}

when building with g++ 5.1.0 , the following errors are shown and project never gets built:

INFO: Processing changes...
INFO: Saving files from: florianwolters/catch
Running: "cmake"  -G "Unix Makefiles" -Wno-dev  ../cmake
-- The C compiler identification is GNU 5.1.0
-- The CXX compiler identification is GNU 5.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done

        BLOCK: florianwolters/catch 
-----------------------------------------------------------
+ LIB: florianwolters_catch
-- Writing default cmake_dummy.cpp for building library
+ EXE: florianwolters_catch_projects_SelfTest_TestMain
+ EXE: florianwolters_catch_projects_SelfTest_ToStringWhich

        BLOCK: agauniyal/cbs-algorithm-sort 
-----------------------------------------------------------
+ LIB: agauniyal_cbs-algorithm-sort
+ EXE: agauniyal_cbs-algorithm-sort_unit_test
-- Initializing variables to create tests with CTest
-- Added custom target for all the tests: 
-- Following targets are defined like tests (excluded from build)
+ TEST: agauniyal_cbs-algorithm-sort_unit_test
-- Configuring done
-- Generating done
-- Build files have been written to: /home/agauniyal/projects/cbs-algorithm-sort/bii/build
Building: "cmake" --build . 
Scanning dependencies of target florianwolters_catch
[ 20%] Building CXX object florianwolters_catch/CMakeFiles/florianwolters_catch.dir/projects/SelfTest/TestMain.cpp.o
In file included from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_impl.hpp:19:0,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch.hpp:47,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/projects/SelfTest/TestMain.cpp:10:
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:73:9: error: invalid suffix "f5615272b0fb51bcd7a669e68f3b4c7a87d93bb" on integer constant
 >>>>>>> 7f5615272b0fb51bcd7a669e68f3b4c7a87d93bb
         ^
In file included from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_expression_lhs.hpp:12:0,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_result_builder.h:91,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_capture.hpp:11,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch.hpp:28,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/projects/SelfTest/TestMain.cpp:10:
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:43:17: error: ‘nullptr_t’ in namespace ‘std’ does not name a type
     inline std::nullptr_t opCast(std::nullptr_t) { return nullptr; }
                 ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:165:58: error: ‘template<Catch::Internal::Operator Op, class T> bool Catch::Internal::compare’ conflicts with a previous declaration
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                          ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:159:44: note: previous declaration ‘namespace Catch::Internal { }::compare’
     template<Operator Op, typename T> bool compare( T* lhs, int rhs ) {
                                            ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:165:53: error: ‘nullptr_t’ is not a member of ‘std’
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                     ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:165:70: error: expected primary-expression before ‘*’ token
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                                      ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:165:72: error: ‘rhs’ was not declared in this scope
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                                        ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:165:76: error: expression list treated as compound expression in initializer [-fpermissive]
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                                            ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:165:44: warning: variable templates only available with -std=c++14 or -std=gnu++14
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                            ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:165:78: error: expected ‘;’ before ‘{’ token
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                                              ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:168:66: error: ‘std::nullptr_t’ has not been declared
     template<Operator Op, typename T> bool compare( T* lhs, std::nullptr_t ) {
                                                                  ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:168:44: error: redefinition of ‘template<Catch::Internal::Operator Op, class T> bool Catch::Internal::compare(T*, int)’
     template<Operator Op, typename T> bool compare( T* lhs, std::nullptr_t ) {
                                            ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_evaluate.hpp:159:44: note: ‘template<Catch::Internal::Operator Op, class T> bool Catch::Internal::compare(T*, int)’ previously declared here
     template<Operator Op, typename T> bool compare( T* lhs, int rhs ) {
                                            ^
In file included from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_expression_lhs.hpp:13:0,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_result_builder.h:91,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_capture.hpp:11,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch.hpp:28,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/projects/SelfTest/TestMain.cpp:10:
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_tostring.h:54:38: error: ‘std::string Catch::toString’ redeclared as different kind of symbol
 std::string toString( std::nullptr_t );
                                      ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_tostring.h:51:13: note: previous declaration ‘std::string Catch::toString(unsigned char)’
 std::string toString( unsigned char value );
             ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_tostring.h:54:23: error: ‘nullptr_t’ is not a member of ‘std’
 std::string toString( std::nullptr_t );
                       ^
In file included from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_impl.hpp:19:0,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch.hpp:47,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/projects/SelfTest/TestMain.cpp:10:
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp: In member function ‘Catch::Totals Catch::Runner::runTests()’:
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:63:1: error: expected primary-expression before ‘<<’ token
 <<<<<<< HEAD
 ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:63:3: error: expected primary-expression before ‘<<’ token
 <<<<<<< HEAD
   ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:63:5: error: expected primary-expression before ‘<<’ token
 <<<<<<< HEAD
     ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:63:7: error: expected primary-expression before ‘<’ token
 <<<<<<< HEAD
       ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:63:9: error: ‘HEAD’ was not declared in this scope
 <<<<<<< HEAD
         ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:64:3: error: expected primary-expression before ‘==’ token
 =======
   ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:64:5: error: expected primary-expression before ‘==’ token
 =======
     ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:64:7: error: expected primary-expression before ‘=’ token
 =======
       ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:65:35: error: expected primary-expression before ‘skippedTestCases’
             std::vector<TestCase> skippedTestCases;
                                   ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:66:91: error: ‘skippedTestCases’ was not declared in this scope
             getRegistryHub().getTestCaseRegistry().getFilteredTests( testSpec, *m_config, skippedTestCases, true );
                                                                                           ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:69:27: error: name lookup of ‘itEnd’ changed for ISO ‘for’ scoping [-fpermissive]
                     it != itEnd;
                           ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:69:27: note: (if you use ‘-fpermissive’ G++ will accept your code)
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:73:1: error: expected primary-expression before ‘>>’ token
 >>>>>>> 7f5615272b0fb51bcd7a669e68f3b4c7a87d93bb
 ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:73:3: error: expected primary-expression before ‘>>’ token
 >>>>>>> 7f5615272b0fb51bcd7a669e68f3b4c7a87d93bb
   ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:73:5: error: expected primary-expression before ‘>>’ token
 >>>>>>> 7f5615272b0fb51bcd7a669e68f3b4c7a87d93bb
     ^
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:73:7: error: expected primary-expression before ‘>’ token
 >>>>>>> 7f5615272b0fb51bcd7a669e68f3b4c7a87d93bb
       ^
In file included from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_impl.hpp:35:0,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch.hpp:47,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/projects/SelfTest/TestMain.cpp:10:
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_tostring.hpp: At global scope:
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_tostring.hpp:163:38: error: ‘std::string Catch::toString’ redeclared as different kind of symbol
 std::string toString( std::nullptr_t ) {
                                      ^
In file included from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_expression_lhs.hpp:13:0,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_result_builder.h:91,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_capture.hpp:11,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch.hpp:28,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/projects/SelfTest/TestMain.cpp:10:
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_tostring.h:199:13: note: previous declaration ‘template<class T, class Allocator> std::string Catch::toString(const std::vector<_Tp, _Alloc>&)’
 std::string toString( std::vector<T,Allocator> const& v ) {
             ^
In file included from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_impl.hpp:35:0,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch.hpp:47,
                 from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/projects/SelfTest/TestMain.cpp:10:
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_tostring.hpp:163:23: error: ‘nullptr_t’ is not a member of ‘std’
 std::string toString( std::nullptr_t ) {
                       ^
florianwolters_catch/CMakeFiles/florianwolters_catch.dir/build.make:54: recipe for target 'florianwolters_catch/CMakeFiles/florianwolters_catch.dir/projects/SelfTest/TestMain.cpp.o' failed
make[2]: *** [florianwolters_catch/CMakeFiles/florianwolters_catch.dir/projects/SelfTest/TestMain.cpp.o] Error 1
CMakeFiles/Makefile2:110: recipe for target 'florianwolters_catch/CMakeFiles/florianwolters_catch.dir/all' failed
make[1]: *** [florianwolters_catch/CMakeFiles/florianwolters_catch.dir/all] Error 2
Makefile:85: recipe for target 'all' failed
make: *** [all] Error 2
ERROR: Build failed

and with clang++ , using bii configure -D CMAKE_CXX_COMPILER=clang++ :

Scanning dependencies of target florianwolters_catch
[ 20%] Building CXX object florianwolters_catch/CMakeFiles/florianwolters_catch.dir/projects/SelfTest/TestMain.cpp.o
In file included from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/projects/SelfTest/TestMain.cpp:10:
In file included from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch.hpp:47:
In file included from /home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/internal/catch_impl.hpp:19:
/home/agauniyal/projects/cbs-algorithm-sort/bii/deps/florianwolters/catch/include/catch_runner.hpp:63:1: error: version control conflict marker in file
<<<<<<< HEAD
^
1 error generated.
florianwolters_catch/CMakeFiles/florianwolters_catch.dir/build.make:54: recipe for target 'florianwolters_catch/CMakeFiles/florianwolters_catch.dir/projects/SelfTest/TestMain.cpp.o' failed
make[2]: *** [florianwolters_catch/CMakeFiles/florianwolters_catch.dir/projects/SelfTest/TestMain.cpp.o] Error 1
CMakeFiles/Makefile2:110: recipe for target 'florianwolters_catch/CMakeFiles/florianwolters_catch.dir/all' failed
make[1]: *** [florianwolters_catch/CMakeFiles/florianwolters_catch.dir/all] Error 2
Makefile:85: recipe for target 'all' failed
make: *** [all] Error 2

I've no idea about errors generated by both compilers specially the clang one. Any kind of help would suffice.

Abhinav Gauniyal
  • 7,034
  • 7
  • 50
  • 93
  • 1
    Looks like `catch/include/catch_runner.hpp` has some diff output in it, maybe a partial version control merge or something. I'd make sure that your local copy of the library code is clean and up to date. – TartanLlama Jun 09 '15 at 11:20
  • 1
    What's there on the line 63 of `catch_runner.hpp`? Looks like merge conflict. – Anton Savin Jun 09 '15 at 11:20
  • `<<<<<<>>>>>> 7f5615272b0fb51bcd7a669e68f3b4c7a87d93bb` @AntonSavin – Abhinav Gauniyal Jun 09 '15 at 11:24
  • 1
    Usually, the single header version of catch has less problems, you can try my own copy in https://www.biicode.com/diego/catch – drodri Jun 09 '15 at 17:34

1 Answers1

3

You most likely have a git merge, either in progress or aborted. These:

<<<<<<< HEAD

=================

>>>>>>> 7f5615272b0fb51bcd7a669e68f3b4c7a87d93bb

are the markers git places where version conflicts arise that cannot be solved automatically. Search for all occurences of <<<<<, do the required edits, possibly commit and then recompile.

If it isn't your code, maybe downloading or cloning again will be a quick solution.

Stefano Sanfilippo
  • 32,265
  • 7
  • 79
  • 80
  • yes this is it. However biicode won't let me modify code since on each find it is going to download this very file. I've filed an issue on github repo. Thanks :) – Abhinav Gauniyal Jun 09 '15 at 11:31
  • I would like to add , this does solves the problem by making it possible to build with clang++ however g++ fails to build with same errors. – Abhinav Gauniyal Jun 09 '15 at 11:40
  • You can override the dependency like this: http://docs.biicode.com/c++/advanced/override_deps.html – amalulla Jun 09 '15 at 17:48