mardi 1 mars 2016

Issues with Inheritance and OpenCL

I am trying to port some code to linux from Windows. I have gotten pretty far, but now I am stuck on an error with inheritance. But I can't figure out what's not working. It appears that It's not importing the header, but I can't figure out why because it seems to me that is should be working.

here is the error output:

/usr/bin/c++   -DHAVE_CLOGS -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -std=c++11 -I/code/cuda/JF-Cut/src/build -I/code/cuda/JF-Cut/src/QVisualizer -I/code/cuda/clogs-install/include -I/usr/local/cuda-7.5/targets/x86_64-linux/include -isystem /opt/Qt/5.5/gcc_64/include -isystem /opt/Qt/5.5/gcc_64/include/QtWidgets -isystem /opt/Qt/5.5/gcc_64/include/QtGui -isystem /opt/Qt/5.5/gcc_64/include/QtCore -isystem /opt/Qt/5.5/gcc_64/./mkspecs/linux-g++    -fPIC -o CMakeFiles/http://ift.tt/1QJNADc -c /code/cuda/JF-Cut/src/QVisualizer/Graph_Cut/QGCWidget.cpp
In file included from /code/cuda/JF-Cut/src/QVisualizer/Graph_Cut/QGCWidget.cpp:44:0:
/code/cuda/JF-Cut/src/QVisualizer/Graph_Cut/../infrastructures/QError.h:45:11: error: ‘cl::Error’ has not been declared
 using cl::Error;
           ^
/code/cuda/JF-Cut/src/QVisualizer/Graph_Cut/../infrastructures/QError.h:48:1: error: expected class-name before ‘{’ token
 {
 ^
/code/cuda/JF-Cut/src/QVisualizer/Graph_Cut/../infrastructures/QError.h: In member function ‘void QError::serialize(std::ostringstream&, cl_int)’:
/home/sansomk/code/cuda/JF-Cut/src/QVisualizer/Graph_Cut/../infrastructures/QError.h:68:13: error: ‘cl::Error’ has not been declared
         cl::Error::serialize(s, code);

Here is the Code for QError.h

#ifndef QERROR_H
#define QERROR_H

#ifndef __CL_ENABLE_EXCEPTIONS
#define __CL_ENABLE_EXCEPTIONS
#endif
// removed #include "../3rdParty/cl/cl_stacktrace.hpp"
#if defined(__APPLE__) || defined(__MACOSX)
#include <OpenCL/cl.hpp>
#else
#include <CL/cl.hpp>
#endif

#define Q_LOGIC_ERROR       -100
#define Q_INVALID_ARGUMENT  -101
#define Q_LENGTH_ERROR      -102
#define Q_OUT_OF_RANGE      -103
#define Q_FUTURE_ERROR      -104
#define Q_RUNTIME_ERROR     -110
#define Q_RANGE_ERROR       -111
#define Q_OVERFLOW_ERROR    -112
#define Q_UNDERFLOW_ERROR   -113
#define Q_SYSTEM_ERROR      -114

using cl::Error;

class QError : public cl::Error
{
protected:
    cl_int level_;
    void serialize(std::ostringstream& s, cl_int code)
    {
        std::string error;
        switch (code)
        {
        case Q_LOGIC_ERROR: error = "Q_LOGIC_ERROR"; break;
        case Q_INVALID_ARGUMENT: error = "Q_INVALID_ARGUMENT"; break;
        case Q_LENGTH_ERROR: error = "Q_LENGTH_ERROR"; break;
        case Q_OUT_OF_RANGE: error = "Q_OUT_OF_RANGE"; break;
        case Q_FUTURE_ERROR: error = "Q_FUTURE_ERROR"; break;
        case Q_RUNTIME_ERROR: error = "Q_RUNTIME_ERROR"; break;
        case Q_RANGE_ERROR: error = "Q_RANGE_ERROR"; break;
        case Q_OVERFLOW_ERROR: error = "Q_OVERFLOW_ERROR"; break;
        case Q_UNDERFLOW_ERROR: error = "Q_UNDERFLOW_ERROR"; break;
        case Q_SYSTEM_ERROR: error = "Q_SYSTEM_ERROR"; break;
        }
        if (!error.empty()) s << " > " << error << ", ";
        cl::Error::serialize(s, code);
    }
public:
    QError(cl_int level, cl_int err, const char * errStr = NULL) : level_(level), cl::Error(err, errStr) {}

    ~QError() throw() {}

    cl_int level(void) const { return level_; }

    virtual const char * what() throw ()
    {
        std::ostringstream s;
        serialize(s, err_);
        errStr_ = s.str();
        return errStr_.c_str();
    }
};

#endif  // QERROR_H

Aucun commentaire:

Enregistrer un commentaire