Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nlbutts opened this issue Apr 17, 2018 · 1 comment

Comments

@nlbutts
Copy link

nlbutts commented Apr 17, 2018

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.

@skal65535
Copy link
Collaborator

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

[1] 8735f25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants