0

I am currently working on a Oculus Rift project (DK1) on Ubuntu 14.04 and I try to compile a github projet. This is a Qt project written in C++. I have the following error about "unique_ptr". I think have installed the right libraries. I know this code have already worked on a Ubuntu computer.

    g++ -c -m64 -pipe -Ofast -Wno-deprecated -O2 -std=c++0x -Wall -W -fPIE  -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I. -o Camera.o Camera.cpp
    In file included from Include/OVR/LibOVR/Include/../Src/OVR_Device.h:33:0,
                 from Include/OVR/LibOVR/Include/OVR.h:35,
                 from Oculus.h:13,
                 from Input.h:13,
                 from Camera.h:12,
                 from Camera.cpp:1:
    Include/OVR/LibOVR/Include/../Src/OVR_DeviceMessages.h: In constructor ‘OVR::MessageCameraFrame::MessageCameraFrame(OVR::DeviceBase*)’:
    Include/OVR/LibOVR/Include/../Src/OVR_DeviceMessages.h:255:13: warning: ‘OVR::MessageCameraFrame::CameraHandle’ will be initialized after [-Wreorder]
     UInt32* CameraHandle;   // Identifies the camera object associated with this frame
             ^
    Include/OVR/LibOVR/Include/../Src/OVR_DeviceMessages.h:249:18: warning:   ‘const UByte* OVR::MessageCameraFrame::pFrameData’ [-Wreorder]
     const UByte* pFrameData;  // a ptr to frame data. 
                  ^
    Include/OVR/LibOVR/Include/../Src/OVR_DeviceMessages.h:226:5: warning:   when initialized here [-Wreorder]
     MessageCameraFrame(DeviceBase* dev)
     ^
Camera.cpp: In constructor ‘Camera::Camera(const vec3&, const vec3&, const vec3&, float, float, const Input&)’:
Camera.cpp:20:18: error: use of deleted function ‘Input::Input(const Input&)’
     speed_ {speed}
                  ^
    In file included from Camera.h:12:0,
                 from Camera.cpp:1:
Input.h:33:7: note: ‘Input::Input(const Input&)’ is implicitly deleted because the default definition would be ill-formed:
 class Input
       ^
    Input.h:33:7: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = GenericOculus; _Dp = std::default_delete<GenericOculus>]’
In file included from /usr/include/c++/4.8/memory:81:0,
                 from LogCpp/Log.h:8,
                 from Oculus.h:23,
                 from Input.h:13,
                 from Camera.h:12,
                 from Camera.cpp:1:
/usr/include/c++/4.8/bits/unique_ptr.h:273:7: error: declared here
       unique_ptr(const unique_ptr&) = delete;
       ^
    Camera.cpp:20:18: warning: a temporary bound to ‘Camera::input_’ only persists until the constructor exits [-Wextra]
     speed_ {speed}
                  ^
    make: *** [Camera.o] Erreur 1

Thank you

C C
  • 1

1 Answers1

0

The problem here lies in this message:

Input.h:33:7: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&)

You're apparently trying to construct a unique_ptr from another unique_ptr. That's forbidden, as unique_ptr can't be copied (that's the point of having a unique pointer). You can only move a unique_ptr to transfer ownership.

So you'll have to revise that code with this information in mind.


Note: As you apparently have a member unique_ptr in your class, and as its copy constructor is deleted (i.e. explicitely forbidden), thus the default copy constructor of your class is itself deleted, which explains the following error message in your stack:

Camera.cpp:20:18: error: use of deleted function ‘Input::Input(const Input&)

Community
  • 1
  • 1
JBL
  • 12,588
  • 4
  • 53
  • 84