1 year ago

#130763

test-img

Jason

There are errors when using Intel DPC++ compiler to compile subroutine with Eigen head file

Just got stuck in compiling a simple C++ program with Eigen C++ when using intel oneAPI DPC++/C++ compiler: The example contains two .cpp files (main.cpp and Preprocessing.cpp) and one include file (struct_INFO.h).

I don't know why the compiler gives errors as the image shows. Error messages from Intel compiler:

duplicate symbol: bool const std::_Is_integral<bool>
duplicate symbol: bool const std::_Is_integral<char>
duplicate symbol: bool const std::_Is_integral<signed char> 
duplicate symbol: bool const std::_Is_integral<unsigned char>
duplicate symbol: bool const std::_Is_integral<wchar_t>
duplicate symbol: bool const std::_Is_integral<char16_t>
duplicate symbol: bool const std::_Is_integral<char32_t>

... All the errors are similar, so I just show some of them.

It seems that I can include neither the Eigen head file (<Eigen/Core>) nor the head file struct_INFO.h, which containing Eigen head file, in my subroutine Preprocessing.cpp.

The only way that I know to fix the problem is to merge the two .cpp files into one.

However, this approach is kind of cumbersome that I need to put all the subroutines in one file as long as I need to use the Eigen variables.

Does anyone know how to solve this problem? Thank you.

  1. main.cpp:

    #include "struct_INFO.h"
    #include <Eigen/Core>
    
    int Preprocessing(struct_INFO& struct_INFO_obj);
    
    int main(int* argc, char** argv)
    {
        struct_INFO struct_INFO_obj;
        Preprocessing(struct_INFO_obj);
        return 0;
    }
    
  2. Preprocessing.cpp

    #include "struct_INFO.h"
    
    int Preprocessing(struct_INFO& struct_INFO_obj)
    {
           return 1;
    }
    
  3. struct_INFO.h

    #include <Eigen/Core>
    
    class struct_INFO
    {
           public:
           Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> Matrix;
    };
    

c++

intel

eigen

dpc++

0 Answers

Your Answer

Accepted video resources