Template

Hello

My module is now finished and ready for testing. It compiles in VS with only a few warnings :smiley:

Everything is also working in panda except when I finally desided to include that tamplate after all. The error message is

And the ‘PFAStarGraph.h’ line in question looks like this


class PFAStarGraph : public PFGraph<AStarNode>

Is this enough information for you guys to help me out or do I need to supply you with some more, I mean it should work (compiles in MSVS).

Hope you can help me out

(EDIT: link to complete VS project http://www.itu.dk/people/petandpovlse/PandaStar.rar )

here is the emplate class

template <typename T> class PFGraph
{
public:
	inline PFGraph(int inWidth, int inHeight)
		:gWidth(inWidth), gHeight(inHeight) {nodeList = new T[gWidth*gHeight+1];};

	// virtual method to add nodes to the graph
	virtual void addNode(T node) = 0;
	// virtual method to print specific node to screen
	virtual void printNode(float x, float y) = 0;
	~PFGraph(){};

	// Template node list
	T * nodeList;
    
	// Map width
	const int gWidth;
	// Map height
	const int gHeight;
};

It seems like the T * nodeList; is causing some problems

The code compiles fine when not using Interrogate.

The problem is occuring while using Interrogate. Could it cause problems to use PUBLISHED in a class that is derived from a template class maybe?

I have tried to look inside files like builderVertex.h from \panda\src\builder but that dosnt really help :frowning:

Any idea what this mean?

built/tmp/libmathutil_igate.obj : warning LNK4042: object specified more than on
ce; extras ignored
libdtoolconfig.lib(libdtoolconfig.dll) : error LNK2005: "public: __thiscall std:
:vector<int,class std::allocator<int> >::~vector<int,class std::allocator<int> >
(void)" (??1?$vector@HV?$allocator@H@std@@@std@@QAE@XZ) already defined in pathf
ind_composite4.obj
libdtoolconfig.lib(libdtoolconfig.dll) : error LNK2005: "public: __thiscall std:
:vector<int,class std::allocator<int> >::vector<int,class std::allocator<int> >(
void)" (??0?$vector@HV?$allocator@H@std@@@std@@QAE@XZ) already defined in pathfi
nd_composite4.obj

The program interrogate is a C++ parser. It reads ANSI C++ syntax (but not Microsoft extensions) and figures out what your C++ code is doing, so that it can generate the Python interfaces.

As with any C++ parser, it is unfortunately difficult to determine exactly where the actual problem is from the error message (the language itself makes this difficult). Chances are good that the actual problem is somewhere above line 27. Perhaps the AStarNode class is not defined to interrogate?

It might be as simple as not having the right directories listed on the include path (the -I parameters to interrogate). If interrogate doesn’t find a header file, it will quietly ignore it and move on, so if AStarNode is defined in one of these other header files that it’s not finding, that could explain your error.

It might help to run interrogate with the -v option (you can edit your script to put this in). That will show you what include files it’s not able to find and also report some other parse errors it’s ignoring.

David

Well well I have managed to get a crude version of the A* module up and running. It is not that optimized(no templates or binary heap) or well structed as I would have liked, but it works. I think the full optimized implementation for Panda will have to wait until I understand interrogate a little better :laughing:

Here is a screenshot of the A* algoritmen up and running, on a little map I just created for visualization purpose.

A special thank you to both David and Josh for all their help.