I am trying to compile the files below. The PosLin.cpp contains the SurTriAuto and SurTriPosRotAndQ functions below. Before adding SurTriPosRotAndQ, it compiled fine, but when I added SurTriPosRotAndQ, I am getting "invalid use of incomplete type ‘struct PosRotAndQ" error messages

I was thinking I could try moving SurTriAuto and SurTriPosRotAndQ to PosLin.h, but since they return "T*", I'm not sure what to do

I have a "t.h" file

namespace TNS
    {
      class T
      {
      public:
        T();
        //other stuff
      }
    }

"geopar.h" file has

#include "t.h"
#include "Geo/Geo.h"

class Geo;
struct PosRotAndQ;

namespace TNS
{
   class GeoP;
   {
    public:
          GeoP();
          T* SurTriAuto(T* surface, Geo* geo, int p);
          T* SurTriPosRotAndQ(T* surface, PosRotAndQ* sur, int p);
   }
}

and "PL.h" has

#include "T/t.h"
#include "Geo/Geo.h"

struct PosRotAndQ {

  TNS::T* surface;
};

class PS{
public: 

  PosExCode cqa(Geo* geo, POpinion* opinion, PosRotAndQ* sur)

  PosRotAndQ mattersur;

}

when I add "include Pos/PL.h" to geopar.h, I get an error saying v.hpp is missing, where v.hpp is part of a 3rd-party software and it is already in my directory

You need to include the "PL.h" file within your PosLin.cpp source file. The problem is most probably that your implementation of SurTriPosRotAndQ requires a complete type for PosRotAndQ, not just a forward declaration. So, if you include the PL.h file from the cpp file, you will have the complete declaration available when implementing SurTriPosRotAndQ. This is the normal way to work with forward declarations, you forward-declare the class in the header and include the header for that class in your cpp file, where you need the complete type.

You need to include the "PL.h" file within your PosLin.cpp source file

Did you mean include the PL.h within the geopar.cpp? By the way, I made a typo in the OP. PL was supposed to be PosLin.

I find this link online that I think can help me solve the problem, in the second dealing with 3rd-party software:
https://latedev.wordpress.com/2013/02/02/common-c-error-messages-1-no-such-file-or-directory/

However, I use make and CMakeLists, so I can't just type "g++ -Ic:/prog/boost1461 myfile.cpp"

How can I perform that same action, except for CMakeLists?

In /ws/larryburns/cmake/ME/Build/sc, I have CMakeLists.txt as

ADD_SUBDIRECTORY (Ut)
ADD_SUBDIRECTORY (ASp)
..

whereas the 3rd-party software seems to be installed in /ws/guy/soft/3rdparty. The cpp files for that 3rd-party software were also copied into the 3rdparty folder in /ws/larryburns/cmake/ME/sc/3rdparty

Here are more details:

The exact error message is :

In file included from /ws/larryburns/cmake/ME/sc/T/../../inc/KIFMM3D/fmm3d/fmm3d.hpp:21:0,
                 from /ws/larryburns/cmake/ME/sc/T/../../inc/P/KiFmmWrapper.h:5,
...
                 from /ws/larryburns/cmake/ME/sc/T/PotGeoP.cpp:10:
/ws/larryburns/cmake/ME/sc/T/../../inc/KIFMM3D/fmm3d/knlmat3d.hpp:21:28: fatal error: common/vec3t.hpp: No such file or directory
compilation terminated.

In the KiFmmWrapper.h file, there is #include "KIFMM3D/fmm3d/fmm3d.hpp".

I also forgot to mention in the CMakeLists in /ws/larryburns/cmake/ME/sc/ME/CMakeLists.txt, there already is "include_directories" :

INCLUDE_DIRECTORIES(../../inc/KIFMM3D)
INCLUDE_DIRECTORIES(../../inc/KIFMM3D/common)

if(USE_MPI_KIFMM)
  ADD_DEFINITIONS(-DWITH_MPI_KIFMM)
  INCLUDE_DIRECTORIES(../../inc/KIFMM3D/fmm3d_mpi)
else(USE_MPI_KIFMM)
  ADD_DEFINITIONS(-UWITH_MPI_KIFMM)
  INCLUDE_DIRECTORIES(../../inc/KIFMM3D/fmm3d)
endif(USE_MPI_KIFMM)

whereas the KIFMM software seems to be installed in /ws/guy/soft/KIFMM3D. The cpp files for that 3rd-party software were also copied into the 3rdparty folder in /ws/larryburns/cmake/ME/sc/KIFMM3D

How can I fix this problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.