RISCSoftware / cpacs_tigl_gen

Generates CPACS schema based classes for TiGL
Apache License 2.0
5 stars 5 forks source link

stringBaseType class: no arguments to CTiglError that depend on a template parameter #44

Closed MarAlder closed 2 years ago

MarAlder commented 2 years ago

I removed the type substitutions for stringBaseType and doubleBaseType as used for TiGL. CPACS-Generator then writes the corresponding classes.

Note: I disabled the renaming of classes in makeClassName() so the naming differs a bit from TiGL

The doubleBaseType class works excellent!

The stringBaseType, on the other hand, causes:

...\stringBaseType.h:75: Fehler: there are no arguments to 'CTiglError' that depend on a template parameter, so a declaration of 'CTiglError' must be available [-fpermissive]
.../stringBaseType.h: In member function 'const P* cpacsLib::generated::stringBaseType::GetParent() const':
.../stringBaseType.h:75:23: error: there are no arguments to 'CTiglError' that depend on a template parameter, so a declaration of 'CTiglError' must be available [-fpermissive]
                 throw CTiglError("bad parent");
                       ^~~~~~~~~~

Both classes look pretty much the same to me. Setting -fpermissive didn't really help. Any ideas in which direction to look at? generated.zip

Thanks and sorry for throwing my errors here... It's already great that doubleBaseType is working so good!

bernhardmgruber commented 2 years ago

The include order probably changed somehow and the header providing CTiglError is not included before stringBaseType.h. Try having a look at your include hierarchy.

MarAlder commented 2 years ago

Hmm, yes, it's certainly related to that. Thanks for the hint. I have omitted the doubleBaseType for now and continued testing with the stringBaseType alone. As long as I only generate classes just for headerType, the stringBaseType class works as desired. As soon as I go up to the aircraftModelType, my uIDManager and uIDObject classes are required. Without the stringBaseType class everything works as expected, only the combination of both still produces the error. A few hours of changing the order of the includes was unfortunately not crowned with success yet.

There are some forum posts where the C++ community is upset about two-phase lookup. May be related to the fact that now CTiGLError is called only in the second phase, after the templates.

Tough stuff for beginners; until a few days ago I didn't even know what templates were. Let's see, somehow I'll find it.

MarAlder commented 2 years ago

The include order probably changed somehow and the header providing CTiglError is not included before stringBaseType.h. Try having a look at your include hierarchy.

Thanks @bernhardmgruber, taking a deeper look into the include order actually solved the problem! :)

MarAlder commented 2 years ago

solved