webmproject/sjpeg

CMakefiles and makefile do not specify -std which results in compilation failure

Opened this issue · 1 comments

I am using Linux Mint 18.1 with GCC 5.4.0-6 and CMake 3.10.0-rc1. I perform the following:
mkdir build
cd build
cmake ..
make -j

I get the following error message:
make[2]: Entering directory '/home/nlbutts/projects/sjpeg/build'
[ 6%] Building CXX object CMakeFiles/sjpeg.dir/src/bit_writer.cc.o
/usr/bin/c++ -I/home/nlbutts/projects/sjpeg/src -O3 -DNDEBUG -fPIC -o CMakeFiles/sjpeg.dir/src/bit_writer.cc.o -c /home/nlbutts/projects/sjpeg/src/bit_writer.cc
In file included from /home/nlbutts/projects/sjpeg/src/bit_writer.h:29:0,
from /home/nlbutts/projects/sjpeg/src/bit_writer.cc:19:
/home/nlbutts/projects/sjpeg/src/sjpeg.h:336:6: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
std::shared_ptr MakeByteSink(std::string* output);
^
/home/nlbutts/projects/sjpeg/src/sjpeg.h:339:6: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
std::shared_ptr MakeByteSink(std::vector* output);
^
/home/nlbutts/projects/sjpeg/src/sjpeg.h:340:17: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
template<> std::shared_ptr MakeByteSink(std::vector<uint8_t>* output);
^
In file included from /home/nlbutts/projects/sjpeg/src/bit_writer.cc:19:0:
/home/nlbutts/projects/sjpeg/src/bit_writer.h: In member function ‘virtual bool sjpeg::Sink::Commit(size_t, size_t, uint8_t**)’:
/home/nlbutts/projects/sjpeg/src/bit_writer.h:63:71: error: ‘nullptr’ was not declared in this scope
data = extra_size ? reinterpret_cast<uint8_t>(&(ptr_)[pos_]) : nullptr;
^
/home/nlbutts/projects/sjpeg/src/bit_writer.cc: In constructor ‘sjpeg::MemorySink::MemorySink(size_t)’:
/home/nlbutts/projects/sjpeg/src/bit_writer.cc:31:12: error: ‘nullptr’ was not declared in this scope
: buf_(nullptr), pos_(0), max_pos_(0) {
^
/home/nlbutts/projects/sjpeg/src/bit_writer.cc: In member function ‘virtual void sjpeg::MemorySink::Reset()’:
/home/nlbutts/projects/sjpeg/src/bit_writer.cc:41:10: error: ‘nullptr’ was not declared in this scope
buf_ = nullptr;
^
/home/nlbutts/projects/sjpeg/src/bit_writer.cc: In member function ‘void sjpeg::MemorySink::Release(uint8_t
*, size_t*)’:
/home/nlbutts/projects/sjpeg/src/bit_writer.cc:49:10: error: ‘nullptr’ was not declared in this scope
buf_ = nullptr;
^
/home/nlbutts/projects/sjpeg/src/bit_writer.cc: In member function ‘virtual bool sjpeg::MemorySink::Commit(size_t, size_t, uint8_t**)’:
/home/nlbutts/projects/sjpeg/src/bit_writer.cc:65:20: error: ‘nullptr’ was not declared in this scope
if (new_buf == nullptr) return false;
^
/home/nlbutts/projects/sjpeg/src/bit_writer.cc: At global scope:
/home/nlbutts/projects/sjpeg/src/bit_writer.cc:79:6: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
std::shared_ptr MakeByteSink(std::string* const output) {
^
/home/nlbutts/projects/sjpeg/src/bit_writer.cc:85:6: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
std::shared_ptr MakeByteSink(std::vector<uint8_t>* const output) {
^
/home/nlbutts/projects/sjpeg/src/bit_writer.cc: In constructor ‘sjpeg::BitWriter::BitWriter(sjpeg::ByteSink*)’:
/home/nlbutts/projects/sjpeg/src/bit_writer.cc:92:64: error: ‘nullptr’ was not declared in this scope
BitWriter::BitWriter(ByteSink* const sink) : sink_(sink), buf_(nullptr) {
^
CMakeFiles/sjpeg.dir/build.make:62: recipe for target 'CMakeFiles/sjpeg.dir/src/bit_writer.cc.o' failed
make[2]: *** [CMakeFiles/sjpeg.dir/src/bit_writer.cc.o] Error 1
make[2]: Leaving directory '/home/nlbutts/projects/sjpeg/build'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/sjpeg.dir/all' failed
make[1]: *** [CMakeFiles/sjpeg.dir/all] Error 2
make[1]: Leaving directory '/home/nlbutts/projects/sjpeg/build'
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

If I update the CMakelists.txt file and add -std=c++11, everything works fine.

I think this was fixed by [1], which explicitly includes in sjpeg.h.
Is it the case?

[1] 8735f25