[Help] Noob Question Compiling MapUtil Class in Simple App

kungfoomasta

13-01-2007 10:28:48

I'm just trying to integrate the Mapsplitter into my app via MapUtil class, but I'm getting linker errors. :oops:


// OGRE
#include "Ogre.h"
// MAPSPLITTER
#include "MapUtil.h"

...

// Create Mapsplitter object
mMapUtil = new Ogre::MapUtil();
// Creates OGRE root and sets up defined resource locations
// mMapUtil->init();



1>Linking...
1>TerrainGenerator.obj : error LNK2001: unresolved external symbol "public: __thiscall Ogre::MapUtil::MapUtil(void)" (??0MapUtil@Ogre@@$$FQAE@XZ)
1>D:\TERRAINGENERATOR\Release\TerrainGenerator.exe : fatal error LNK1120: 1 unresolved externals


My Project Includes:

D:\DagonCVS\ogrenew\OgreMain\include
D:\DagonCVS\ogreaddons\paginglandscape\PlugIns\PagingLandScape2\include
D:\DagonCVS\ogreaddons\paginglandscape\PlugIns\PagingLandScape2\src
D:\DagonCVS\ogreaddons\paginglandscape\Tools\MapSplitter\include
D:\DagonCVS\ogreaddons\paginglandscape\Tools\MapSplitter\src


Lib Directories:

D:\DagonCVS\ogrenew\OgreMain\lib\$(ConfigurationName)


Additional Dependencies:

$(NoInherit) OgreMain.lib


(Anybody knows what "NoInherit" means? It's usually there by default)

Sorry for my noob knowledge, but I can't figure this out. I would think that just adding include directories to the header and source files for MapUtil would be all I need, but apparently a linker error is generated. :(

KungFooMasta

kungfoomasta

13-01-2007 10:40:32

Another thing I noticed, from looking at the Tool_MapSplitter project, is that there is an include path to the plugins/paginglandscape2\include\ path, as well as the include path, but these files are also added into the project? What is the purpose of "linking" to these files, and also including them into the directory? Just like using Ogre.h file, I don't also add the Ogre.h file into my project... why is this done, and why is this needed? (Assuming this is needed, as the project compiles with no errors...)

KungFooMasta

kungfoomasta

13-01-2007 10:53:08

Sorry for Triple Post...

I tried to mimick the previous TerrainGenerator code in CVS (since it compiled fine in the past... I'm working on a totally new version on my machine..) and I'm getting the following messages:


1>Compiling...
1>stdafx.cpp
1>Compiling...
1>MapUtil.cpp
1>..\..\DagonCVS\ogreaddons\paginglandscape\Tools\MapSplitter\src\MapUtil.cpp(1177) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
1>MapSplitter.cpp
1>..\..\DagonCVS\ogreaddons\paginglandscape\Tools\MapSplitter\src\MapSplitter.cpp(1087) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
1>MapSplatter.cpp
1>..\..\DagonCVS\ogreaddons\paginglandscape\Tools\MapSplitter\src\MapSplatter.cpp(646) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
1>MapNormaler.cpp

...



Has anybody been able to create a MapUtil Object in their code? What is your setup, in terms of include paths, additional dependencies, and MapUtil related files added to the project?

Thanks,

KungFooMasta

kungfoomasta

16-01-2007 18:15:40

Nobody knows how to include MapUtil class into their code? :cry:

KungFooMasta

Falagard

16-01-2007 18:41:12

GOOF used them, and so did the old MapEditor project. I think you've figured this out, but yes you need to add the MapUtil cpp files to your project, as you mentioned. The reason this is done is because the MapTool is NOT compiled as a library on its own, it is a console application.

If you're having problems with precompiled headers, simply right click on the added cpp files, go properties, and set it to "Do not use precompiled header"

kungfoomasta

16-01-2007 19:58:22

I did include them, but still got linker errors. Will follow your advice regarding precompiled headers and see if the issue is fixed.

Also, is there any reason not to compile it as a library? I will try this and see if my project compiles successfully.

Thanks,

KungFooMasta

Falagard

16-01-2007 21:48:45


Also, is there any reason not to compile it as a library? I will try this and see if my project compiles successfully.


It wasn't designed to be a library but I wouldn't mind if Tuan modified it to a library instead. It's not as simple as "compiling it as a library" though, you need to export symbols properly for the classes you're using externally, etc.

Not very hard, but if you're having a hard time with it already it might be a bit tricky to modify it.

syedhs

17-01-2007 05:02:16

Easy steps on creating a lib/dll
1. Create a new library project
2. Add all headers/source (*.cpp/*.h) into the project.
3. Remove the block which has int main(...)
4. Expose all the classes. The steps are more or less here:
http://www.ogre3d.org/phpBB2/viewtopic.php?t=27594
5. Done..!

tuan kuranes

17-01-2007 12:34:03

4. Expose all the classes. The steps are more or less here:
Only needed for DLL. Lib can be done without.

@kungfoomasta: If it's for terraingenerator, current CVS does have a version that compiles with Maputil included...

kungfoomasta

17-01-2007 18:17:48

Yah, that's true, but I can't seem to imitate that and use it in the project on my PC. There is some issue with the .resx file that I can't modify the UI in design mode from the project in CVS (I get a ".resx already exists" error that does not go away, I have to blow away .NET with task manager). I actually redid a lot of UI and made a better version of the app, however I need the mapUtil included in order to slap in all of the logic I had already implemented from the CVS project. If possible, can the mapUtil code be made into a library, so that people can easily include it into apps?

It would be nice to link to the headers, include mapUtil.lib, and be able to build MapUtil and execute MapSplitter functions with ease.

KungFooMasta

tuan kuranes

18-01-2007 13:32:04

If possible, can the mapUtil code be made into a library, so that people can easily include it into apps?

Too much work for a soon to be deprecated version... as I try to put as less as possible time in PLSM2 to get some time for plsm3.
Patch welcome, but that means a patch that also modify other build script platforms (linux, vc7, etc.)

There is some issue with the .resx file that I can't modify the UI in design mode from the project in CVS
I managed to reproduce the problem.
Just Erase all .resx in the misc folder.
I updated that in CVS too.

Anyway, now you should be able to work on CVS version and produce patch files.

kungfoomasta

19-01-2007 07:27:10

I'm still finding that the issue exists. I just updated from CVS 5 minutes ago, and upon saving BaseForm.h (in design view), I see the following error:

"File 'd:\DagonCVS\ogreaddons\paginglandscape\Tools\TerrainGenerator\script\BaseForm.resx' already exists in the project."

BaseForm.resx is not in the misc folder, but the script folder. In the .NET Solution Explorer, there are 2 BaseForm.resx files underneath BaseForm.h at the time of error (its trying to add another resx file..). I don't understand why the previous .resx file can't be overwritten.

If you can fix this issue, I would be really thankful. I wish I could get past the .resx and MapUtil issues :(

KungFooMasta

tuan kuranes

19-01-2007 11:45:58

Just erase all .resx whatever folder they're in.