Interrogate error: unknown type 'PUBLISHED'

Hi there, I’m trying to build a module using interrogate, and I keep getting the same two(?) errors which I can’t make any sense of.
The command I’m using:

interrogate -module p3fst-ent -library playerEntBase -oc playerEntBase_igate.cxx -od -python-native -nomangle playerEntBase.h

The errors:

/c/(path to header file)/playerEntBase.h:15:1: error: unknown type 'PUBLISHED'
/c/(path to header file)/playerEntBase.h:15:10: error: syntax error, unexpected ':'

And here is the header file in question, cut down for readabliity:

#pragma once
#include "dtoolBase.h"
 //A bunch of code necessary includes here

class playerEntBase : public ActorNode

	bool isStanding = false;

	//Give the ActorNode base a name
	ActorNode("default Playertype");
	//Set up the main bounding box
	//a bunch of code goes here
	//Set up the four spheres used for detecting raised surfaces the character can climb up
	//a bunch of code goes here
	//create the collision Segment, for checking whether or not a character can be considered "standing"
	//a bunch of code goes here


I don’t understand why PUBLISHED: isn’t being recognised. Does anyone know why this might be happening? any help is greatly appriciated.


I think you should compile your project with library support.


If you don’t mind, can I ask for clarification? I do plan on ultimately compiling my project using those libraries, when I’m making the .pyd file.
I’ve added libp3interrogatedb.lib (the only of those three libraries) to linker>input>additional dependencies. This by itself hasn’t changed the issue at all.

So far, I’ve just been running interrogate on the header file I’ve been writing to normally, without any additional compilation. Is there some step I’m missing? Why isn’t PUBLISHED: being treated as macro for __published by interrogate?

I think that if you use panda macros, then you should also include the header file, pandabase.h

I took the time to check this case, and found that the answer is simple.

error: syntax error, unexpected ':'

Just replace it with a colon.


I do not know why panda sources use a colon and not a dot with a comma. Perhaps this is somehow handled by the build system. I think @rdb knows this point better.

This solved the problem. Thank you!!!

No, you should definitely use :, not a semi-colon!

The idea is that you define a macro like this:

#define PUBLISHED __published
#define PUBLISHED public

Then when the sources are read by interrogate (assuming you set -DCPPPARSER) it is substituted with the special interrogate-recognized __published symbol, but when compiling with a normal compiler, it is substituted with public.

You can also just include dtoolbase.h from the Panda headers, which contains this very definition. But you do need to also pass -DCPPPARSER to interrogate.

1 Like

However, I checked it does not change the state of things, the same error is issued.

// dtoolbase.h defines the PUBLISHED macro if the CPPPARSER macro is defined
#include "dtoolbase.h"

class MyBufferClass {
  // This method is publicly accessible to Python and C++
  void set_data(const string &str);

  // C++-only method
  char *get_buffer();

call: D:\Panda3D-1.10.11-x64\bin\interrogate.exe -DCPPPARSER -module test -oc test_igate.cxx -od -python-native example.h

D:\Code\Interrogate>D:\Panda3D-1.10.11-x64\bin\interrogate.exe -DCPPPARSER -module test -oc test_igate.cxx -od -python-native example.h
/d/Code/Interrogate/example.h:5:1: error: unknown type 'PUBLISHED'
/d/Code/Interrogate/example.h:5:10: error: syntax error, unexpected ':'
Error parsing file: 'example.h'

Edit: I suspect I just need to specify the path for the headers.

I think we need details about how the interrogate detects the inclusion of headers, at the moment it gives the impression that it is not tracked in any way.

If you don’t mind me asking, how would you recommend doing so? I first tried using -s but I got the error “illegal operation: -s”

I didn’t get the result, I used the parameters:
-S and -I

You also need to pass -D__cplusplus in order to emulate a C++ compiler instead of a C compiler.

There is a recommended set of flags in the manual, I recommend you use it.

1 Like

This post used to be me asking an additional question. Im editing this now to just have the solution to said question since it would be useful for anyone reading through this if thet have the same problem.

The way i passed filepaths to interrogate was like either -S C:/panda3d or -S/C:/panda3d.

In reality, interrogate can only find files if directories are passed like -S/panda3d, with no spaces and omitting C:/

1 Like

interrogate uses the Panda filename syntax like everywhere else in Panda, so it should be /c/panda3d/…

1 Like