udoprog / c10t

A minecraft cartography tool
Other
226 stars 50 forks source link

Compiled in view to use for 1.14, some error when compiling #302

Closed tanaka141 closed 5 years ago

tanaka141 commented 5 years ago

allways present during compilation :

[ 69%] Building CXX object CMakeFiles/c10t.dir/src/main.cpp.o
In file included from /home/minecraft/c10tCreation/c10t/src/main.cpp:18:0:
/home/minecraft/c10tCreation/c10t/src/json.hpp: In destructor ‘json::object::~object()’:
/home/minecraft/c10tCreation/c10t/src/json.hpp:120:24: warning: deleting object of abstract class type ‘json::basic_json’ which has non-virtual d                                      estructor will cause undefined behaviour [-Wdelete-non-virtual-dtor]
           delete (*it).second;
                        ^
/home/minecraft/c10tCreation/c10t/src/json.hpp: In destructor ‘json::array::~array()’:
/home/minecraft/c10tCreation/c10t/src/json.hpp:158:19: warning: deleting object of abstract class type ‘json::basic_json’ which has non-virtual d                                      estructor will cause undefined behaviour [-Wdelete-non-virtual-dtor]
           delete *it;
                   ^
[ 71%] Building CXX object CMakeFiles/c10t.dir/src/dlopen.cpp.o

And here :

[ 88%] Building CXX object CMakeFiles/c10t.dir/src/json.cpp.o
In file included from /home/minecraft/c10tCreation/c10t/src/json.cpp:1:0:
/home/minecraft/c10tCreation/c10t/src/json.hpp: In destructor ‘json::object::~object()’:
/home/minecraft/c10tCreation/c10t/src/json.hpp:120:24: warning: deleting object of abstract class type ‘json::basic_json’ which has non-virtual d                                      estructor will cause undefined behaviour [-Wdelete-non-virtual-dtor]
           delete (*it).second;
                        ^
/home/minecraft/c10tCreation/c10t/src/json.hpp: In destructor ‘json::array::~array()’:
/home/minecraft/c10tCreation/c10t/src/json.hpp:158:19: warning: deleting object of abstract class type ‘json::basic_json’ which has non-virtual d                                      estructor will cause undefined behaviour [-Wdelete-non-virtual-dtor]
           delete *it;
                   ^
[ 90%] Building CXX object CMakeFiles/c10t.dir/src/generate_map.cpp.o
In file included from /home/minecraft/c10tCreation/c10t/src/generate_map.cpp:31:0:
/home/minecraft/c10tCreation/c10t/src/json.hpp: In destructor ‘json::object::~object()’:
/home/minecraft/c10tCreation/c10t/src/json.hpp:120:24: warning: deleting object of abstract class type ‘json::basic_json’ which has non-virtual d                                      estructor will cause undefined behaviour [-Wdelete-non-virtual-dtor]
           delete (*it).second;
                        ^
/home/minecraft/c10tCreation/c10t/src/json.hpp: In destructor ‘json::array::~array()’:
/home/minecraft/c10tCreation/c10t/src/json.hpp:158:19: warning: deleting object of abstract class type ‘json::basic_json’ which has non-virtual d                                      estructor will cause undefined behaviour [-Wdelete-non-virtual-dtor]
           delete *it;
                   ^
/home/minecraft/c10tCreation/c10t/src/generate_map.cpp: In function ‘bool generate_map(std::ostream&, std::ostream&, std::ostream&, settings_t&,                                       std::vector<std::__cxx11::basic_string<char> >&, boost::filesystem::path&, boost::filesystem::path&)’:
/home/minecraft/c10tCreation/c10t/src/generate_map.cpp:578:20: warning: typedef ‘hello_f’ locally defined but not used [-Wunused-local-typedefs]
     typedef void (*hello_f)();
                    ^
[ 92%] Building CXX object CMakeFiles/c10t.dir/src/generate_statistics.cpp.o

Don't know why ?

evildeeds commented 5 years ago

Which C++ compiler and version are you trying to build c10t with?

tanaka141 commented 5 years ago

gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609

evildeeds commented 5 years ago

I'm looking at yet another compiling error... oh well

src/image/image_base.cpp:43:23: error: call of overloaded ‘abs(pos_t)’ is ambiguous
int dx = abs(x2-x1)
$ gcc --version
gcc (Gentoo 8.3.0-r1 p1.1) 8.3.0
$ eselect gcc list
 [1] x86_64-pc-linux-gnu-8.3.0 *
udoprog commented 5 years ago

So yeah, this is a memory leak. The basic_json class doesn't have a virtual destructor, which would mean the subclass destructors are not called:

If someone wants to fix it, this is where it is defined: https://github.com/udoprog/c10t/blob/master/src/json.hpp#L51

So we need something like this to basic_json:

virtual ~basic_json() = 0;
evildeeds commented 5 years ago

Yepp, but thats a compiler warning, I'm guessing its the same compiler error as mine? pos_t is defined in image_base.hpp as uint64_t, calling abs on an unsigned integer makes no sense. I'm testing a patch now.

Edit: nevermind I misunderstood; I'm opening a diffrent issue and patching it there.

tanaka141 commented 5 years ago

i think i waked up some people here :D

evildeeds commented 5 years ago

This issue is a duplicate of #270

tanaka141 commented 5 years ago

for json, the proposal https://github.com/evildeeds/c10t/commit/bd365e4ac2870783bbe65c99b94a4f13a28946f9 was made in my local src.

No more message.

But this error allways appear :

[ 78%] Building CXX object CMakeFiles/c10t.dir/src/generate_map.cpp.o
/home/minecraft/c10tCreation/c10t/src/generate_map.cpp: In function ‘bool generate_map(std::ostream&, std::ostream&, std::ostream&, settings_t&, std::vector<std::__cxx11::basic_string<char> >&, boost::filesystem::path&, boost::filesystem::path&)’:
/home/minecraft/c10tCreation/c10t/src/generate_map.cpp:578:20: warning: typedef ‘hello_f’ locally defined but not used [-Wunused-local-typedefs]
     typedef void (*hello_f)();
                    ^
[ 80%] Building CXX object CMakeFiles/c10t.dir/src/generate_statistics.cpp.o
udoprog commented 5 years ago

@evildeeds heh, so you've had the fix for 5 years in your branch :D. Wanna setup a PR?

tanaka141 commented 5 years ago

your proposal was good in 2014 :D

i think the https://github.com/evildeeds/c10t/commit/bd365e4ac2870783bbe65c99b94a4f13a28946f9 must be approved

tanaka141 commented 5 years ago

@evildeeds heh, so you've had the fix for 5 years in your branch :D. Wanna setup a PR?

Perhaps, don't know HOW-TO :D

evildeeds commented 5 years ago

Heh, that not why. But that was a fascinating discovery, maybe I messed up back then and accidentally merged it onto my master branch before making any pull requests.

evildeeds commented 5 years ago

Merged, reopen if this did not resolve the issue