Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt cannot find the header files
Forum Updated to NodeBB v4.3 + New Features

Qt cannot find the header files

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hassan-math
    wrote on 27 Jan 2021, 06:20 last edited by
    #1

    Hi All,

    I'm running a simple code using libigl (a simple geometry library) and Eigen libraries. So, I added their paths in the .pro file by

    INCLUDEPATH += "[mypath]/C_libraries/libigl/include" 
    INCLUDEPATH += "[mypath]/C_libraries/eigen/Eigen"
    

    The above paths are the libraries' directories. All the header files are available in the mentioned paths. But when I trying following code, Qt cannot find header files:

    #include <igl/cotmatrix.h>
    #include <Eigen/Dense>
    #include <Eigen/Sparse>
    #include <iostream>
    
    int main()
    {
      Eigen::MatrixXd V(4,2);
      V<<0,0,
         1,0,
         1,1,
         0,1;
      Eigen::MatrixXi F(2,3);
      F<<0,1,2,
         0,2,3;
      Eigen::SparseMatrix<double> L;
      igl::cotmatrix(V,F,L);
      std::cout<<"Hello, mesh: "<<std::endl<<L*V<<std::endl;
      return 0;
    }
    

    Qt can find first header (cotmatrix.h from igl), but for next one I got following error:

    error: Eigen/Dense: No such file or directory
    12 | #include <Eigen/Dense>
    | ^~~~~~~~~~~~~

    could you please let me know why does it happen? How can I resolve it?
    I'm using Ubuntu 20.4 on iMac machine.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on 27 Jan 2021, 06:28 last edited by
      #2

      Do you have "[mypath]/C_libraries/eigen/Eigen/Eigen/Dense" file? (That's three eigen OMG...)
      I think your include path might should be "[mypath]/C_libraries/eigen"

      H 1 Reply Last reply 27 Jan 2021, 07:47
      0
      • B Bonnie
        27 Jan 2021, 06:28

        Do you have "[mypath]/C_libraries/eigen/Eigen/Eigen/Dense" file? (That's three eigen OMG...)
        I think your include path might should be "[mypath]/C_libraries/eigen"

        H Offline
        H Offline
        Hassan-math
        wrote on 27 Jan 2021, 07:47 last edited by
        #3

        @Bonnie Hi, that's not three eigen. It's "[mypath]/C_libraries/eigen/Eigen/Dense". Yes, its available in the mentioned directory. I tried "[mypath]/C_libraries/eigen", but it cannot find the header files.

        J B 2 Replies Last reply 27 Jan 2021, 07:49
        0
        • H Hassan-math
          27 Jan 2021, 07:47

          @Bonnie Hi, that's not three eigen. It's "[mypath]/C_libraries/eigen/Eigen/Dense". Yes, its available in the mentioned directory. I tried "[mypath]/C_libraries/eigen", but it cannot find the header files.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 27 Jan 2021, 07:49 last edited by
          #4

          @Hassan-math You should try with "[mypath]/C_libraries" as it is trying to include "#include <Eigen/Dense>"...

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          H 1 Reply Last reply 27 Jan 2021, 07:57
          2
          • J jsulm
            27 Jan 2021, 07:49

            @Hassan-math You should try with "[mypath]/C_libraries" as it is trying to include "#include <Eigen/Dense>"...

            H Offline
            H Offline
            Hassan-math
            wrote on 27 Jan 2021, 07:57 last edited by
            #5

            @jsulm I tried, but it doesn't work. Same error...

            J 1 Reply Last reply 27 Jan 2021, 08:00
            0
            • H Hassan-math
              27 Jan 2021, 07:47

              @Bonnie Hi, that's not three eigen. It's "[mypath]/C_libraries/eigen/Eigen/Dense". Yes, its available in the mentioned directory. I tried "[mypath]/C_libraries/eigen", but it cannot find the header files.

              B Offline
              B Offline
              Bonnie
              wrote on 27 Jan 2021, 07:59 last edited by Bonnie
              #6

              @Hassan-math said in Qt cannot find the header files:

              It's "[mypath]/C_libraries/eigen/Eigen/Dense".

              Then it should be "[mypath]/C_libraries/eigen".
              Rerun qmake after you modify the .pro file, better also clean and rebuild.

              Tip:
              If you use "[mypath]/C_libraries/eigen/Eigen" as include path, then you should only

              #include <Dense>
              #include <Sparse>
              

              But this will have problems if the header files includes <Eigen/xx> in themselves.

              1 Reply Last reply
              0
              • H Hassan-math
                27 Jan 2021, 07:57

                @jsulm I tried, but it doesn't work. Same error...

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 27 Jan 2021, 08:00 last edited by
                #7

                @Hassan-math You should do a complete clean rebuild after changing pro file: delete build folder, run qmake and build.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                H 1 Reply Last reply 27 Jan 2021, 08:11
                1
                • J jsulm
                  27 Jan 2021, 08:00

                  @Hassan-math You should do a complete clean rebuild after changing pro file: delete build folder, run qmake and build.

                  H Offline
                  H Offline
                  Hassan-math
                  wrote on 27 Jan 2021, 08:11 last edited by
                  #8

                  @jsulm and @Bonnie Thank you. Yes, it works. When I rebuilt it, it's resolved. The path "[mypath]/C_libraries/eigen" works for me...

                  1 Reply Last reply
                  0

                  1/8

                  27 Jan 2021, 06:20

                  • Login

                  • Login or register to search.
                  1 out of 8
                  • First post
                    1/8
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved