udoprog / c10t

A minecraft cartography tool
Other
225 stars 50 forks source link

color.hpp:107:33: error: ‘roundf’ was not declared in this scope #296

Closed josefnpat closed 10 years ago

josefnpat commented 10 years ago

Howdy! I'm trying to build c10t on my server, but there seems to be an error.

Full system/dependency/repro log here:

seppi@penguinista:~/minecraft$ uname -a
Linux penguinista 3.15.4-x86_64-linode45 #1 SMP Mon Jul 7 08:42:36 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

seppi@penguinista:~/minecraft$ cat /etc/issue
Ubuntu 12.04.5 LTS \n \l

seppi@penguinista:~/minecraft$ sudo apt-get install build-essential cmake libpng-dev zlib1g-dev libboost-all-dev libfreetype6-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libpng12-dev' instead of 'libpng-dev'
libpng12-dev is already the newest version.
zlib1g-dev is already the newest version.
libboost-all-dev is already the newest version.
build-essential is already the newest version.
cmake is already the newest version.
libfreetype6-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 20 not upgraded.

seppi@penguinista:~/minecraft$ sudo apt-get install libboost-thread1.46.1 libboost-filesystem1.46.1 libboost-system1.46.1 libboost-test1.46.1 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libboost-test1.46.1 is already the newest version.
libboost-filesystem1.46.1 is already the newest version.
libboost-system1.46.1 is already the newest version.
libboost-thread1.46.1 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 20 not upgraded.

seppi@penguinista:~/minecraft$ git clone git://github.com/udoprog/c10t.git c10t-git
Cloning into 'c10t-git'...
remote: Counting objects: 12006, done.
remote: Total 12006 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (12006/12006), 10.96 MiB | 4.10 MiB/s, done.
Resolving deltas: 100% (3364/3364), done.

seppi@penguinista:~/minecraft$ cd  c10t-git/

seppi@penguinista:~/minecraft/c10t-git$ git submodule init
Submodule 'libs/unc' (git://github.com/udoprog/unc.git) registered for path 'libs/unc'

seppi@penguinista:~/minecraft/c10t-git$ git submodule update
Cloning into 'libs/unc'...
remote: Counting objects: 109, done.
remote: Total 109 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (109/109), 1.31 MiB, done.
Resolving deltas: 100% (47/47), done.
Submodule path 'libs/unc': checked out '6238492182785d282af7af03fa2aaceaf1fd8df4'

seppi@penguinista:~/minecraft/c10t-git$ mkdir build

seppi@penguinista:~/minecraft/c10t-git$ cd build/

seppi@penguinista:~/minecraft/c10t-git/build$ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - 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
-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found version "1.2.3.4")
-- Found PNG: /usr/lib/i386-linux-gnu/libpng.so (Required is at least version "1.2")
-- Found Freetype: /usr/lib/i386-linux-gnu/libfreetype.so (Required is at least version "2")
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE 
-- Boost version: 1.46.1
-- Found the following Boost libraries:
--   thread
--   filesystem
--   system
-- Configuring done
-- Generating done
-- Build files have been written to: /home/seppi/minecraft/c10t-git/build

seppi@penguinista:~/minecraft/c10t-git/build$ make c10t
Scanning dependencies of target c10t-mc
[  2%] Building CXX object src/mc/CMakeFiles/c10t-mc.dir/blocks.cpp.o
In file included from /home/seppi/minecraft/c10t-git/src/mc/blocks.hpp:6:0,
                 from /home/seppi/minecraft/c10t-git/src/mc/blocks.cpp:3:
/home/seppi/minecraft/c10t-git/src/image/color.hpp: In function ‘std::ostream& operator<<(std::ostream&, const color&)’:
/home/seppi/minecraft/c10t-git/src/image/color.hpp:107:33: error: ‘roundf’ was not declared in this scope
make[3]: *** [src/mc/CMakeFiles/c10t-mc.dir/blocks.cpp.o] Error 1
make[2]: *** [src/mc/CMakeFiles/c10t-mc.dir/all] Error 2
make[1]: *** [CMakeFiles/c10t.dir/rule] Error 2
make: *** [c10t] Error 2
josefnpat commented 10 years ago

Forgot to mention, I cloned at c66b02c46fb6630085cb44bd8a4d7eb5b0c497bc

Golden-Lion commented 10 years ago

Hm, that's strange ... Can you edit the c10t-git/src/image/color.hpp file and add the following text after line 7 and see if it works then?

    #include <math.h>
josefnpat commented 10 years ago

That worked perfectly; Would you like me to make a PR, or can you get this line in?

Here's my patch;

diff --git a/src/image/color.hpp b/src/image/color.hpp
index 8fb4587..a97b290 100644
--- a/src/image/color.hpp
+++ b/src/image/color.hpp
@@ -5,6 +5,7 @@

 #include <stdint.h>
 #include <assert.h>
+#include <math.h>

 #include <string>
 #include <sstream>
josefnpat commented 10 years ago

:heart: