I get the following compile error

Front page Forums Installation I get the following compile error

This topic contains 1 reply, has 1 voice, and was last updated by  klaus 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1519

    klaus
    Member

    [ 48%] Building CXX object src/CMakeFiles/paralution.dir/solvers/eigenvalue/cg_hn.cpp.o
    [ 49%] Building CXX object src/CMakeFiles/paralution.dir/solvers/eigenvalue/ampe_sira.cpp.o
    [ 50%] Building CXX object src/CMakeFiles/paralution.dir/utils/log.cpp.o
    [ 50%] Building CXX object src/CMakeFiles/paralution.dir/utils/allocate_free.cpp.o
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp: In Instanziierung von »void paralution::allocate_host(int, DataType**) [with DataType = float]«:
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:180:94: von hier erfordert
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:110:16: Fehler: ISO-C++ verbietet Vergleich zwischen Zeiger und Ganzzahl [-fpermissive]
    if ((*ptr) == false) { // nullptr
    ~~~~~~~^~~~~~~~
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp: In Instanziierung von »void paralution::allocate_host(int, DataType**) [with DataType = double]«:
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:181:94: von hier erfordert
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:110:16: Fehler: ISO-C++ verbietet Vergleich zwischen Zeiger und Ganzzahl [-fpermissive]
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp: In Instanziierung von »void paralution::allocate_host(int, DataType**) [with DataType = std::complex<float>]«:
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:183:94: von hier erfordert
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:110:16: Fehler: ISO-C++ verbietet Vergleich zwischen Zeiger und Ganzzahl [-fpermissive]
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp: In Instanziierung von »void paralution::allocate_host(int, DataType**) [with DataType = std::complex<double>]«:
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:184:94: von hier erfordert
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:110:16: Fehler: ISO-C++ verbietet Vergleich zwischen Zeiger und Ganzzahl [-fpermissive]
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp: In Instanziierung von »void paralution::allocate_host(int, DataType**) [with DataType = int]«:
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:186:94: von hier erfordert
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:110:16: Fehler: ISO-C++ verbietet Vergleich zwischen Zeiger und Ganzzahl [-fpermissive]
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp: In Instanziierung von »void paralution::allocate_host(int, DataType**) [with DataType = unsigned int]«:
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:187:94: von hier erfordert
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:110:16: Fehler: ISO-C++ verbietet Vergleich zwischen Zeiger und Ganzzahl [-fpermissive]
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp: In Instanziierung von »void paralution::allocate_host(int, DataType**) [with DataType = char]«:
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:188:94: von hier erfordert
    /home/klaus/OpenFOAM/klaus-5.0/paralution-1.1.0/src/utils/allocate_free.cpp:110:16: Fehler: ISO-C++ verbietet Vergleich zwischen Zeiger und Ganzzahl [-fpermissive]
    make[2]: *** [src/CMakeFiles/paralution.dir/build.make:1335: src/CMakeFiles/paralution.dir/utils/allocate_free.cpp.o] Fehler 1
    make[1]: *** [CMakeFiles/Makefile2:86: src/CMakeFiles/paralution.dir/all] Fehler 2
    make: *** [Makefile:130: all] Fehler 2

    How can I fix it?

    Klaus

    #1520

    klaus
    Member

    required change in allocate_free.cpp to avoid compile error: change false to nullptr

    // *********************************************************
    // C++ style and error handling

    *ptr = new (std::nothrow) DataType[size];

    // was: if ((*ptr) == false) { // nullptr
    if ((*ptr) == nullptr) { // nullptr i.e. correction
    LOG_INFO(“Cannot allocate memory”);
    LOG_VERBOSE_INFO(2, “Size of the requested buffer = ” << size*sizeof(DataType));
    FATAL_ERROR(__FILE__, __LINE__);
    }
    // *********************************************************

    Is this approach correct?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.