mandelbrot-vanilla.cc not compiling
ObsidianNA opened this issue · 1 comments
Trying to compile the file 'mandelbrot-vanilla.cc' using GCC 7.1.0 on Linux Mint 18 Cinnamon 64-bit. I get the following errors:
cpp_paral/mandelbrot-vanilla.cc: In function ‘double Iterate(double, double)’:
cpp_paral/mandelbrot-vanilla.cc:36:42: error: ‘ESCAPE_RADIUS_SQUARED’ was not declared in this scope
const double escape_radius_squared = ESCAPE_RADIUS_SQUARED;
^~~~~~~~~~~~~~~~~~~~~
cpp_paral/mandelbrot-vanilla.cc:37:25: error: ‘MAXITER’ was not declared in this scope
const int maxiter = MAXITER;
^~~~~~~
cpp_paral/mandelbrot-vanilla.cc:37:25: note: suggested alternative: ‘WEXITED’
const int maxiter = MAXITER;
^~~~~~~
WEXITED
In file included from cpp_paral/mandelbrot-vanilla.cc:1:0:
cpp_paral/mandelbrot-vanilla.cc: In function ‘int main()’:
cpp_paral/common.inc:106:33: error: ‘PROG_NAME’ was not declared in this scope
auto& tab = timings[PROG_NAME];
^
cpp_paral/mandelbrot-vanilla.cc:73:5: note: in expansion of macro ‘MAINLOOP_START’
MAINLOOP_START(1);
^~~~~~~~~~~~~~
cpp_paral/common.inc:106:33: note: suggested alternative: ‘__LC_NAME’
auto& tab = timings[PROG_NAME];
^
cpp_paral/mandelbrot-vanilla.cc:73:5: note: in expansion of macro ‘MAINLOOP_START’
MAINLOOP_START(1);
^~~~~~~~~~~~~~
The compiler doesn't like that ‘ESCAPE_RADIUS_SQUARED’ and 'MAXITER' are not declared, could I get some inside into this issue? Would this program only work on DOS?
These are #defines you must pass on the compiler commandline. For convenience, use the supplied Makefile to build. Example:
$ make mandelbrot-vanilla
g++ -std=c++14 -Ofast -march=native -Wall -Wextra -DMAXITER=8000 -DESCAPE_RADIUS_SQUARED=6*6 -Wno-clobbered -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -lSDL -DPROG_NAME="\"vanilla\"" -pthread -lSDL mandelbrot-vanilla.cc -o mandelbrot-vanilla
mandelbrot-vanilla.cc: In function ‘double mylog2(double)’:
mandelbrot-vanilla.cc:8:77: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
std::uint64_t half_bits = reinterpret_cast<const std::uint64_t&>(half);
^
mandelbrot-vanilla.cc:12:53: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
m = reinterpret_cast<const std::uint64_t&>(value);
^
mandelbrot-vanilla.cc:16:42: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
x = reinterpret_cast<const double&>(m);This program will work on DOS if you can cross-compile SDL2 for DOS. In other words, it will not work on DOS.