BrainlessLabs / bun

Bun is a simple to use C++ Object Database, Object Relational Mapper (ORM) and key-value library
http://www.codeproject.com/Articles/1100449/Cplusplus-Object-Relational-Mapping-ORM-Eating-the
BSD 3-Clause "New" or "Revised" License
106 stars 16 forks source link

Error when compile #69

Open mvnaz opened 4 years ago

mvnaz commented 4 years ago

I just included bun.hpp

#include "blib/bun/bun.hpp"

and I try to compile it, but I get error:

blib/bun/impl/orm.hpp:1995:20: error: ‘type_conversion’ is not a class template
             struct type_conversion<SimpleObjHolder<T>> {
                    ^~~~~~~~~~~~~~~
blib/bun/impl/orm.hpp:1995:36: error: ‘SimpleObjHolder’ was not declared in this scope
             struct type_conversion<SimpleObjHolder<T>> {
                                    ^~~~~~~~~~~~~~~
blib/bun/impl/orm.hpp:1995:36: note: suggested alternative:
blib/bun/impl/orm.hpp:415:20: note:   ‘blib::bun::__private::SimpleObjHolder’
             struct SimpleObjHolder {
                    ^~~~~~~~~~~~~~~
blib/bun/impl/orm.hpp:1995:20: error: ‘struct blib::bun::__private::type_conversion’ redeclared as different kind of symbol
             struct type_conversion<SimpleObjHolder<T>> {
                    ^~~~~~~~~~~~~~~
blib/bun/impl/orm.hpp:1944:20: note: previous declaration ‘template<class T> struct blib::bun::__private::type_conversion’
             struct type_conversion {
                    ^~~~~~~~~~~~~~~
blib/bun/impl/orm.hpp:1995:53: error: expected unqualified-id before ‘>’ token
             struct type_conversion<SimpleObjHolder<T>> {
                                                     ^~
blib/bun/impl/orm.hpp:2105:14: warning: extra ‘;’ [-Wpedantic]
             };
              ^
blib/bun/impl/orm.hpp:2114:12: error: ‘type_conversion’ is not a class template
     struct type_conversion<blib::bun::__private::SimpleObjHolder<T>> {
            ^~~~~~~~~~~~~~~
blib/bun/impl/orm.hpp:2114:67: error: conflicting declaration of template ‘template<class T> struct soci::type_conversion’
     struct type_conversion<blib::bun::__private::SimpleObjHolder<T>> {
                                                                   ^~
In file included from /usr/local/include/soci/exchange-traits.h:11:0,
                 from /usr/local/include/soci/into-type.h:13,
                 from /usr/local/include/soci/blob-exchange.h:12,
                 from /usr/local/include/soci/soci.h:18,
                 from /home/mike/Documents/PROJECTS/C/blib/bun/impl/DbBackend.hpp:9,
                 from blib/bun/impl/orm.hpp:41,
                 from blib/bun/bun.hpp:3,
                 from main.cpp:12:
/usr/local/include/soci/type-conversion-traits.h:19:8: note: previous declaration ‘template<class T, class Enable> struct soci::type_conversion’
 struct type_conversion
        ^~~~~~~~~~~~~~~
In file included from blib/bun/bun.hpp:3:0,
                 from main.cpp:12:
blib/bun/impl/orm.hpp:1900:48: warning: ‘blib::bun::{anonymous}::unique_constraint’ defined but not used [-Wunused-variable]
             static blib::bun::UniqueConstraint unique_constraint;
                                                ^~~~~~~~~~~~~~~~~
In file included from /home/mike/Documents/PROJECTS/C/third_party/spdlog/formatter.h:44:0,
                 from /home/mike/Documents/PROJECTS/C/third_party/spdlog/sinks/base_sink.h:14,
                 from /home/mike/Documents/PROJECTS/C/third_party/spdlog/logger.h:15,
                 from /home/mike/Documents/PROJECTS/C/third_party/spdlog/spdlog.h:14,
                 from /home/mike/Documents/PROJECTS/C/blib/bun/impl/DbLogger.hpp:11,
                 from /home/mike/Documents/PROJECTS/C/blib/bun/impl/DbBackend.hpp:11,
                 from blib/bun/impl/orm.hpp:41,
                 from blib/bun/bun.hpp:3,
                 from main.cpp:12:
/home/mike/Documents/PROJECTS/C/third_party/spdlog/details/pattern_formatter_impl.h:148:27: warning: ‘fmt::MemoryWriter& nlohmann::detail::pad_n_join(fmt::MemoryWriter&, int, int, int, char)’ defined but not used [-Wunused-function]
 static fmt::MemoryWriter& pad_n_join(fmt::MemoryWriter& w, int v1, int v2, int v3, char sep)
                           ^~~~~~~~~~
/home/mike/Documents/PROJECTS/C/third_party/spdlog/details/pattern_formatter_impl.h:141:27: warning: ‘fmt::MemoryWriter& nlohmann::detail::pad_n_join(fmt::MemoryWriter&, int, int, char)’ defined but not used [-Wunused-function]
 static fmt::MemoryWriter& pad_n_join(fmt::MemoryWriter& w, int v1, int v2, char sep)
                           ^~~~~~~~~~
In file included from /home/mike/Documents/PROJECTS/C/third_party/spdlog/formatter.h:44:0,
                 from /home/mike/Documents/PROJECTS/C/third_party/spdlog/sinks/base_sink.h:14,
                 from /home/mike/Documents/PROJECTS/C/third_party/spdlog/logger.h:15,
                 from /home/mike/Documents/PROJECTS/C/third_party/spdlog/spdlog.h:14,
                 from /home/mike/Documents/PROJECTS/C/blib/bun/impl/DbLogger.hpp:11,
                 from /home/mike/Documents/PROJECTS/C/blib/bun/impl/DbBackend.hpp:11,
                 from blib/bun/impl/orm.hpp:41,
                 from blib/bun/bun.hpp:3,
                 from main.cpp:12:
/home/mike/Documents/PROJECTS/C/third_party/spdlog/details/pattern_formatter_impl.h:76:12: warning: ‘int nlohmann::detail::to12h(const tm&)’ defined but not used [-Wunused-function]
 static int to12h(const tm& t)
            ^~~~~
/home/mike/Documents/PROJECTS/C/third_party/spdlog/details/pattern_formatter_impl.h:71:20: warning: ‘const char* nlohmann::detail::ampm(const tm&)’ defined but not used [-Wunused-function]
 static const char* ampm(const tm& t)
                    ^~~~
In file included from /home/mike/Documents/PROJECTS/C/third_party/spdlog/spdlog.h:13:0,
                 from /home/mike/Documents/PROJECTS/C/blib/bun/impl/DbLogger.hpp:11,
                 from /home/mike/Documents/PROJECTS/C/blib/bun/impl/DbBackend.hpp:11,
                 from blib/bun/impl/orm.hpp:41,
                 from blib/bun/bun.hpp:3,
                 from main.cpp:12:
/home/mike/Documents/PROJECTS/C/third_party/spdlog/common.h:81:20: warning: ‘spdlog::level::short_level_names’ defined but not used [-Wunused-variable]
 static const char* short_level_names[] { "T", "D", "I", "W", "E", "C", "O" };
                    ^~~~~~~~~~~~~~~~~
/home/mike/Documents/PROJECTS/C/third_party/spdlog/common.h:79:20: warning: ‘spdlog::level::level_names’ defined but not used [-Wunused-variable]
 static const char* level_names[] { "trace", "debug", "info",  "warning", "error", "critical", "off" };
                    ^~~~~~~~~~~
<builtin>: recipe for target 'main' failed
make: *** [main] Error 1

I am trying it on ubuntu 18.04.

Makefile content:

LDFLAGS := -L/usr/local/lib -L/home/mike/Documents/PROJECTS/C/libs/socket \
-I/home/mike/Documents/PROJECTS/C/third_party/unqlite -I/home/mike/Documents/PROJECTS/C -I/home/mike/Documents/PROJECTS/C/third_party
LDLIBS :=  -lchilkat-9.5.0 -lpthread -lresolv -lsocket
EXECUTABLE := main
CXXFLAGS=-g -std=c++17 -Wall -pedantic

all: $(EXECUTABLE)

clean:
    rm -f $(EXECUTABLE) *.o

gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)

To compile program I just execute make command inside source folder.

I am newbie in C and most of all it is problem not related to bun.. Probably my compiler is not right version ?

BrainlessLabs commented 4 years ago

Can you tell me the compiler version you are using?