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.
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.
Related
I am trying to build one of the cgal demos from the developer website.
I have installed cgal using brew install cgal.
I also have installed qt5 version 5.15.2 using brew install qt5
However, when I try to build a demo (I am looking at the same one given in the example $HOME/CGAL-5.2.1/examples/Triangulation_) I get a long error from make that I don't know how to interpret.
My computer is running OS X 11.0.1.
Clang is version 12.0.0
/opt/homebrew/include/QtCore/qglobal.h:667:65: error: expected '>'
typename = std::enable_if_t<std::is_arithmetic_v<T> && std::is_arithmetic_v<U> &&
^
/opt/homebrew/include/QtCore/qglobal.h:667:65: error: expected ',' or '>' in template-parameter-list
/opt/homebrew/include/QtCore/qglobal.h:668:66: error: expected unqualified-id
std::is_floating_point_v<T> == std::is_floating_point_v<U> &&
^
/opt/homebrew/include/QtCore/qglobal.h:679:35: error: no type named 'Promoted' in namespace
'QTypeTraits::detail'
using Promoted = typename detail::Promoted<T, U>::type;
~~~~~~~~~~~~~~~~~^~~~~~~~
/opt/homebrew/include/QtCore/qglobal.h:679:43: error: expected ';' after alias declaration
using Promoted = typename detail::Promoted<T, U>::type;
^
/opt/homebrew/include/QtCore/qglobal.h:691:31: error: no template named 'Promoted' in namespace 'QTypeTraits'
constexpr inline QTypeTraits::Promoted<T, U> qMin(const T &a, const U &b)
~~~~~~~~~~~~~^
/opt/homebrew/include/QtCore/qglobal.h:693:28: error: no template named 'Promoted' in namespace 'QTypeTraits'
using P = QTypeTraits::Promoted<T, U>;
~~~~~~~~~~~~~^
/opt/homebrew/include/QtCore/qglobal.h:694:5: error: unknown type name 'P'
P _a = a;
^
/opt/homebrew/include/QtCore/qglobal.h:695:5: error: unknown type name 'P'
P _b = b;
^
/opt/homebrew/include/QtCore/qglobal.h:699:31: error: no template named 'Promoted' in namespace 'QTypeTraits'
constexpr inline QTypeTraits::Promoted<T, U> qMax(const T &a, const U &b)
~~~~~~~~~~~~~^
/opt/homebrew/include/QtCore/qglobal.h:701:28: error: no template named 'Promoted' in namespace 'QTypeTraits'
using P = QTypeTraits::Promoted<T, U>;
~~~~~~~~~~~~~^
/opt/homebrew/include/QtCore/qglobal.h:702:5: error: unknown type name 'P'
P _a = a;
^
/opt/homebrew/include/QtCore/qglobal.h:703:5: error: unknown type name 'P'
P _b = b;
^
/opt/homebrew/include/QtCore/qglobal.h:707:31: error: no template named 'Promoted' in namespace 'QTypeTraits'
constexpr inline QTypeTraits::Promoted<T, U> qBound(const T &min, const U &val, const T &max)
~~~~~~~~~~~~~^
/opt/homebrew/include/QtCore/qglobal.h:710:31: error: no template named 'Promoted' in namespace 'QTypeTraits'
constexpr inline QTypeTraits::Promoted<T, U> qBound(const T &min, const T &val, const U &max)
~~~~~~~~~~~~~^
/opt/homebrew/include/QtCore/qglobal.h:713:31: error: no template named 'Promoted' in namespace 'QTypeTraits'
constexpr inline QTypeTraits::Promoted<T, U> qBound(const U &min, const T &val, const T &max)
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
A very late answer but my solution was to uninstall Qt6 so that you only have Qt5. It is possible you may have both installed. Header files from both can conflict and confuse make. To properly do so:
Find all of the Qt versions you have installed with Homebrew:
brew list | grep qt
# You should see something like "qt qt#5"
Remove qt (which is Qt6)
brew uninstall qt
You should now have only Qt5 left. Try doing the build again, see if the issue is fixed.
I'm trying to compile the EnTT library (version 2.7.3 for cpp14) using MinGW GCC-6.3.0 in Eclipse Oxygen. When compiling, I get these errors:
Info: Internal Builder is used for build
g++ -std=c++1y -D__GXX_EXPERIMENTAL_CXX0X__ -O0 -g3 -Wall -c -fmessage-length=0 -std=c++14 -o "source\\main.o" "..\\source\\main.cpp"
In file included from c:\mingw\include\entt\entt.hpp:10:0,
from ..\source\includes.hpp:23,
from ..\source\main.cpp:1:
c:\mingw\include\entt\entity/helper.hpp: In function 'void entt::connect(entt::Sink<void(entt::Registry<Entity>&, Entity)>)':
c:\mingw\include\entt\entity/helper.hpp:56:19: error: parse error in template argument list
sink.template connect<dependency<Entity, Dependency...>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\mingw\include\entt\entity/helper.hpp:56:19: error: expected identifier
c:\mingw\include\entt\entity/helper.hpp: In function 'void entt::disconnect(entt::Sink<void(entt::Registry<Entity>&, Entity)>)':
c:\mingw\include\entt\entity/helper.hpp:79:19: error: parse error in template argument list
sink.template disconnect<dependency<Entity, Dependency...>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\mingw\include\entt\entity/helper.hpp:79:19: error: expected identifier
Here are the truculent functions in question:
template<typename Entity, typename... Component>
void dependency(Registry<Entity> ®istry, const Entity entity) {
using accumulator_type = int[];
accumulator_type accumulator = { ((registry.template has<Component>(entity) ? void() : (registry.template assign<Component>(entity), void())), 0)... };
(void)accumulator;
}
template<typename... Dependency, typename Entity>
inline void connect(Sink<void(Registry<Entity> &, const Entity)> sink) {
sink.template connect<dependency<Entity, Dependency...>>();
}
template<typename... Dependency, typename Entity>
inline void disconnect(Sink<void(Registry<Entity> &, const Entity)> sink) {
sink.template disconnect<dependency<Entity, Dependency...>>();
}
I have want to build a shared object/shared library to be used by an executable later on.
I have a directory with my own *.cpp as well as the corresponding *.h files.
All the files are located in the same directory as my makefile (-I.):
#makefile to create shared library w/o executable from own headers and tesseract
CC = g++
INCL = -I. -I/usr/include/tesseract/ -I/usr/include/leptonica/
CFLAGS= -Wall -g -c -fPIC
LDFLAGS = -shared
LIBS = libtesseract.a liblept.a
RM = rm -f
TARGET_LIB = libTargetLib.so
SRCS = *.cpp
OBJS = $(SRCS:.cpp=.o)
.PHONY: all
all: ${TARGET_LIB}
$(TARGET_LIB): $(OBJS)
$(CC) $(LDFLAGS) $(INCL) -Wl,-rpath=/usr/lib/x86_64-linux-gnu/ -o $(TARGET_LIB) $^ -L/usr/lib/x86_64-linux-gnu/ -llept -ltesseract
$(OBJS): $(SRCS)
$(CC) $(CFLAGS) $(SRCS)
The library files to be linked, libtesseract.a and liblept.a are in the location /usr/lib/x86_64-linux-gnu, I doublechecked.
I am aware of this problem: ambiguous symbol File: tesscallback.h so I also commented out the correspondent lines.
When I run make, I get this error (tons of lines more):
In file included from /usr/include/tesseract/baseapi.h:34:0,
from file1.h:16,
from file1.cpp:4: /usr/include/tesseract/tesscallback.h:296:12: error: expected
nested-name-specifier before ‘remove_reference’ typename
remove_reference::type p1_;
^~~~~~~~~~~~~~~~ /usr/include/tesseract/tesscallback.h:296:12: error: expected ‘;’ at
end of member declaration
/usr/include/tesseract/tesscallback.h:296:28: error: expected
unqualified-id before ‘<’ token typename remove_reference::type
p1_;
^ /usr/include/tesseract/tesscallback.h: In constructor ‘_ConstTessMemberResultCallback_1_0::_ConstTessMemberResultCallback_1_0(const T*,
_ConstTessMemberResultCallback_1_0::MemberSignature, P1)’: /usr/include/tesseract/tesscallback.h:301:29: error: class
‘_ConstTessMemberResultCallback_1_0’ does not have any
field named ‘p1_’
member_(member), p1_(p1) { }
^~~ /usr/include/tesseract/tesscallback.h: In member function ‘virtual R
_ConstTessMemberResultCallback_1_0::Run()’: /usr/include/tesseract/tesscallback.h:305:38: error: ‘p1_’ was not
declared in this scope
R result = (object_->*member_)(p1_);
^~~ /usr/include/tesseract/tesscallback.h:308:38: error: ‘p1_’ was not
declared in this scope
R result = (object_->member_)(p1_);
^~~ /usr/include/tesseract/tesscallback.h: At global scope:
/usr/include/tesseract/tesscallback.h:326:12: error: expected
nested-name-specifier before ‘remove_reference’ typename
remove_reference::type p1_;
^~~~~~~~~~~~~~~~ /usr/include/tesseract/tesscallback.h:326:12: error: expected ‘;’ at
end of member declaration
/usr/include/tesseract/tesscallback.h:326:28: error: expected
unqualified-id before ‘<’ token typename remove_reference::type
p1_;
^ /usr/include/tesseract/tesscallback.h: In constructor ‘_ConstTessMemberResultCallback_1_0::_ConstTessMemberResultCallback_1_0(const T,
_ConstTessMemberResultCallback_1_0::MemberSignature, P1)’: /usr/include/tesseract/tesscallback.h:331:29: error: class
‘_ConstTessMemberResultCallback_1_0’ does not have
any field named ‘p1_’
member_(member), p1_(p1) { }
^~~ /usr/include/tesseract/tesscallback.h: In member function ‘virtual
void _ConstTessMemberResultCallback_1_0::Run()’:
/usr/include/tesseract/tesscallback.h:335:27: error: ‘p1_’ was not
declared in this scope
(object_->*member_)(p1_);
^~~ /usr/include/tesseract/tesscallback.h:337:27: error: ‘p1_’ was not
declared in this scope
(object_->*member_)(p1_);
When I do not comment it out (i. e., lines still there), I get:
In file included from /usr/include/tesseract/baseapi.h:34:0,
from process_houghlines.h:18,
from process_houghlines.cpp:3: /usr/include/tesseract/tesscallback.h:278:29: error:
‘remove_reference’ is not a class template template
struct remove_reference { typedef T type; };
^~~~~~~~~~~~~~~~ /usr/include/tesseract/tesscallback.h:278:29: error: redefinition of
‘struct remove_reference’
/usr/include/tesseract/tesscallback.h:277:29: note: previous
definition of ‘struct remove_reference’ template
struct remove_reference { typedef T type; };
^~~~~~~~~~~~~~~~ /usr/include/tesseract/tesscallback.h:296:12: error: expected
nested-name-specifier before ‘remove_reference’ typename
remove_reference::type p1_;
^~~~~~~~~~~~~~~~ /usr/include/tesseract/tesscallback.h:296:12: error: expected ‘;’ at
end of member declaration
/usr/include/tesseract/tesscallback.h:296:28: error: expected
unqualified-id before ‘<’ token typename remove_reference::type
p1_;
^ /usr/include/tesseract/tesscallback.h: In constructor ‘_ConstTessMemberResultCallback_1_0::_ConstTessMemberResultCallback_1_0(const T*,
_ConstTessMemberResultCallback_1_0::MemberSignature, P1)’: /usr/include/tesseract/tesscallback.h:301:29: error: class
‘_ConstTessMemberResultCallback_1_0’ does not have any
field named ‘p1 ’
member_(member), p1_(p1) { }
^~~ /usr/include/tesseract/tesscallback.h: In member function ‘virtual R
_ConstTessMemberResultCallback_1_0::Run()’: /usr/include/tesseract/tesscallback.h:305:38: error: ‘p1_’ was not
declared in this scope
R result = (object_->*member_)(p1_);
^~~ /usr/include/tesseract/tesscallback.h:308:38: error: ‘p1_’ was not
declared in this scope
R result = (object_->member_)(p1_);
^~~ /usr/include/tesseract/tesscallback.h: At global scope:
/usr/include/tesseract/tesscallback.h:326:12: error: expected
nested-name-specifier before ‘remove_reference’ typename
remove_reference::type p1_;
^~~~~~~~~~~~~~~~ /usr/include/tesseract/tesscallback.h:326:12: error: expected ‘;’ at
end of member declaration
/usr/include/tesseract/tesscallback.h:326:28: error: expected
unqualified-id before ‘<’ token typename remove_reference::type
p1_;
^ /usr/include/tesseract/tesscallback.h: In constructor ‘_ConstTessMemberResultCallback_1_0::_ConstTessMemberResultCallback_1_0(const T,
_ConstTessMemberResultCallback_1_0::MemberSignature, P1)’: /usr/include/tesseract/tesscallback.h:331:29: error: class
‘_ConstTessMemberResultCallback_1_0’ does not have
any field named ... (reoccurring error)
The files file1.h and file1.cpp:
...
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>
...
and
...
#include "file1.h"
...
The files file2.h and file2.cpp:
...
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>
...
and
...
#include "file2.h"
...
I dont even understand, why the errors differ, since the headers are to the extend of using Tesseract just equal and one time the error occurs in one, than in the other file.
Thank you so much for any help.
when i make some program in using scons, there happen error like,
error: unknown type name 'constexpr'
error: expected unqualified-id
I'm already installed xcode and xquartz latest version.
this is my mac clang version
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
And, i attached my whole error log just in case.
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:54:10: error: unknown type name 'constexpr'
static constexpr double pi = 3.1415;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:54:20: error: expected unqualified-id
static constexpr double pi = 3.1415;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:55:10: error: unknown type name 'constexpr'
static constexpr double twopi = 2*pi;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:55:20: error: expected unqualified-id
static constexpr double twopi = 2*pi;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:56:10: error: unknown type name 'constexpr'
static constexpr double halfpi = pi/2;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:56:20: error: expected unqualified-id
static constexpr double halfpi = pi/2;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:57:10: error: unknown type name 'constexpr'
static constexpr double pi2 = pi*pi;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:57:20: error: expected unqualified-id
static constexpr double pi2 = pi*pi;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:62:10: error: unknown type name 'constexpr'
static constexpr double millimeter = 1.;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:62:20: error: expected unqualified-id
static constexpr double millimeter = 1.;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:63:10: error: unknown type name 'constexpr'
static constexpr double millimeter2 = millimeter*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:63:20: error: expected unqualified-id
static constexpr double millimeter2 = millimeter*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:64:10: error: unknown type name 'constexpr'
static constexpr double millimeter3 = millimeter*millimeter*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:64:20: error: expected unqualified-id
static constexpr double millimeter3 = millimeter*millimeter*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:66:10: error: unknown type name 'constexpr'
static constexpr double centimeter = 10.*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:66:20: error: expected unqualified-id
static constexpr double centimeter = 10.*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:67:10: error: unknown type name 'constexpr'
static constexpr double centimeter2 = centimeter*centimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:67:20: error: expected unqualified-id
static constexpr double centimeter2 = centimeter*centimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:68:10: error: unknown type name 'constexpr'
static constexpr double centimeter3 = centimeter*centimeter*centimeter;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
scons: *** [build/macosx64/rat.o] Error 1
scons: building terminated because of errors.
I'm really thanks for any comment.
Correct answer to this problem is to compile with c++11 support enabled ( for clang -std=c++11 ) in order to have the constexpr keyword recognized.
Scenario:
I'm building software across two different machines.
One of these machines has a fully compliant C++11 version of g++.
The other does not.
Machine 1 (Linux):
$ g++ --version
g++ (Ubuntu 5.1.0-0ubuntu11~14.04.1) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Machine 2 (Windows with Cygwin):
$ g++ --version
g++ (GCC) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The C++ software I'm building across these two machines supports all the way back to C++98.
However, newer features of C++ will be used if they are available.
(The software in question, is C++ Catch for unit testing).
Problem:
I have a generic makefile that will build this software. On Cygwin it builds the software successfully. On Linux, with the newer compiler, it fails to build, because I assume it detects the version of the compiler and attempts to use more modern C++ features.
Here is a dump of the errors for glancing purposes. Mostly just nullptr_t related. Maybe something to do with newer rules on template deduction(not entirely sure):
catch.hpp:833:17: error: ‘nullptr_t’ in namespace ‘std’ does not name a type
inline std::nullptr_t opCast(std::nullptr_t) { return nullptr; }
^
catch.hpp:954: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 ) {
^
catch.hpp:948:44: note: previous declaration ‘namespace Catch::Internal { }::compare’
template<Operator Op, typename T> bool compare( T* lhs, int rhs ) {
^
catch.hpp:954:53: error: ‘nullptr_t’ is not a member of ‘std’
template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
^
catch.hpp:954:70: error: expected primary-expression before ‘*’ token
template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
^
catch.hpp:954:72: error: ‘rhs’ was not declared in this scope
template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
^
catch.hpp:954:76: error: expression list treated as compound expression in initializer [-fpermissive]
template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
^
catch.hpp:954: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 ) {
^
catch.hpp:954:78: error: expected ‘;’ before ‘{’ token
template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
^
catch.hpp:957:66: error: ‘std::nullptr_t’ has not been declared
template<Operator Op, typename T> bool compare( T* lhs, std::nullptr_t ) {
^
catch.hpp:957: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 ) {
^
catch.hpp:948: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 main.cpp:2:0:
catch.hpp:1088:38: error: ‘std::string Catch::toString’ redeclared as different kind of symbol
std::string toString( std::nullptr_t );
^
catch.hpp:1085:13: note: previous declaration ‘std::string Catch::toString(unsigned char)’
std::string toString( unsigned char value );
^
catch.hpp:1088:23: error: ‘nullptr_t’ is not a member of ‘std’
std::string toString( std::nullptr_t );
^
In file included from main.cpp:2:0:
catch.hpp:7336:38: error: ‘std::string Catch::toString’ redeclared as different kind of symbol
std::string toString( std::nullptr_t ) {
^
In file included from main.cpp:2:0:
catch.hpp:1232: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 main.cpp:2:0:
catch.hpp:7336:23: error: ‘nullptr_t’ is not a member of ‘std’
std::string toString( std::nullptr_t ) {
This can be easily fixed on the Linux machine by ensuring that g++ gets compiled with the --std=c++11 flag. However, I don't want two separate makefiles across the two machines. I can't add the --std=c++11 flag to both builds, because version 4.9 doesn't have that flag yet.
Question:
How can I enable cross-compilation using the same command on different versions of g++? The code builds differently based on the versions of g++ -- in which case, sometimes the std flag needs to be passed.
Additional:
I've tried giving g++ the flag --std=c++98 for both builds, but it still fails on the Linux build. The goal here is to use the same kind of command across both machines.
On Windows platforms, I recommend to use Stephan Lavavej's Nuwen Distro. The only snag is that you can't use the std::thread facilities, but boost::thread provides an almost seamless alternative.
On Windows I would recommend switching to MSYS2 especially if you need c++11 support. Latest release has got mingw64 g++4.9.2. I was able to successfully built my Ubuntu project heavily using c++11/boost/python whereas I wasn't able to do that on Cygwin or MSVC2015 RC. MSYS2 has got it's package manager called pacman which is kind of apt-get/yum equivalent.
There is quite large number of prebuilt stuff which availibility you can check here.
Very compact introduction here