[SOLVED] GeoMipTerrain in C++

I’m trying to do something using GeoMipTerrain, and I get an error when calling the “generate” method. I gave a look at the sources, and I realized that the weird error only happens when using some method present at “geomipterrain.cxx”. When calling any inline method it seems to work.
The error: (when calling: terrain->generate();)

hotpursuit.obj : error LNK2001: unresolved external symbol "public: void __thiscall GeoMipTerrain::generate(void)" (?generate@GeoMipTerrain@@QAEXXZ)

Did I forgot some lib? What’s necessary to run GeoMipTerrain???
I create the object sucessfully, and call its inlines methods having no problems.

terrain->get_root().set_sz(20.0); // no error (is in .I)
terrain->set_factor(100.0);  // no error (is in .I)
terrain->generate(); // error - (is in geomipterrain.cxx)
terrain->get_elevation(40.0, 50.0); //error (is in geomipterrain.cxx)

Any Ideas?
ps.: Sorry for my english.

It should be in libpanda. Did you link to libpanda.dll or libpanda.so?
If you did, you might have an old version of Panda3D. What version do you have? Did you compile Panda3D yourself or did you use a pre-built binary?
In the pre-built binaries, as of Panda3D 1.5.1, it is included.

…a temporary solution could be to make all the functions inline.

I’m using Panda3D 1.5.2, Visual Studio 2005, and I’ve tried with both versions (pre-built and the one I compiled).

I’m linking libpanda.lib in Visual Studio.
I’d make the VS config and I can run pview properly.
There some missing config to do?

The buildlog showing the process “Searching libraries”:


We can see libpanda.lib being found, but not the GeoMipTerrain.
What’s happening?

I’m confused. If it’s usable from python, why wouldn’t it be from C++?
Can you try importing GeoMipTerrain from python code and see if that works?
Do you maybe have an older version of Panda3D interfering? Any downloadable binary of version Panda3D 1.5.1 and higher should be equipped with GeoMipTerrain.

I’m 100% sure it’s really libpanda containing the geoMipTerrain.
Can you try this to see whether python can find it:

python -c 'import libpanda as l;print dir(l).count("GeoMipTerrain")'

Or list the symbols:

$ nm libpanda.so | grep -i geoMipTerrain | grep -i generate
016f3404 d Dtool_GeoMipTerrain_generate_79_comment
005f5cb0 t _Z31Dtool_GeoMipTerrain_generate_79P7_objectS0_S0_
005cbb30 T _ZN13GeoMipTerrain14generate_blockEttt
005d1150 T _ZN13GeoMipTerrain8generateEv
017764cc b _ZZ31Dtool_GeoMipTerrain_generate_79P7_objectS0_S0_E13key_word_list

I found the problem!

It’s in the panda’s source.
In the header: geoMipTerrain.h:

class GeoMipTerrain

When it’d be:

class EXPCL_PANDA_GRUTIL GeoMipTerrain

Then, I correct it, recompile the Panda, and now everything works fine!

Correct me if I’m wrong…
Maybe this is not the right way to solve it. [Despite I’m quite sure that it is what was wrong]

[size=75]Sorry again for my english…[/size]

Oh! That could be right indeed, nice find :slight_smile: I guess I just forgot to add that when I submitted it.
I just checked in a fix to CVS, thanks for reporting this.