IrrLicht static link in VC.NET (2003) - problems

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
one_eddie
Posts: 4
Joined: Wed Apr 20, 2005 10:30 am

IrrLicht static link in VC.NET (2003) - problems

Post by one_eddie »

Please forgive me i'm new to english.

I'v got VC.NET 2003 from MSDNAA.
I'v got a problem with IrrLicht.
I set IrrLicht to Static lib in General properities -> General -> Configuration type

Then i add this:

Code: Select all

#if defined(WIN32) && !defined(IRRLICHT_STATIC)
#ifdef IRRLICHT_EXPORTS
#define IRRLICHT_API __declspec(dllexport)
#else
#define IRRLICHT_API __declspec(dllimport)
#endif // IRRLICHT_EXPORT
#else
#define IRRLICHT_API
#endif // WIN32
to IrrLicht.h and this:

Code: Select all

#if !defined(IRRLICHT_STATIC)
#ifdef IRRLICHT_EXPORTS
#define IRRLICHT_API __declspec(dllexport)
#else
#define IRRLICHT_API __declspec(dllimport)
#endif
#else
#define IRRLICHT_API
#endif 
to CIrrDeviceWin32.cpp, as shown in http://irrlicht.sourceforge.net/phpBB2/ ... php?t=2709
And commented out not needed ones.

Then i add IRRLICHT_STATIC to my projekt in general properities -> C/C++ -> Preprocessor so it's like this: WIN32;_DEBUG;_CONSOLE;IRRLICHT_STATIC

IrrLicht general properities -> C/C++ -> Preprocessor looks like this: WIN32;_DEBUG;_WINDOWS;_USRDLL;IRRLICHT_EXPORTS

IrrLicht comlipes fine. Lib is created.
But when I compile application it throws somthing likie this:
Linking...
Creating library Debug/App.lib and object Debug/App.exp
My projekt General properities -> General -> Configuration type is set to Application (exe), so there is no need to create lib? Why is it created? (first problem)

It's linking to exe too.

After a clean build i ge this:
irrlicht.lib(CGUIButton.obj) : warning LNK4204: 'c:\MyProjects\Application\Debug\vc70.pdb' is missing debugging information for referencing module; linking object as if no debug info
How to fix this?

Please help me.
djceejay
Posts: 41
Joined: Fri Feb 25, 2005 11:42 am

Post by djceejay »

I don't think you can mix compile types. I think the Irrlicht library you are using is in Release build and the program you are compiling is in Debug build. This could be the cause for the:
is missing debugging information for referencing module; linking object as if no debug info
This is just a guess - I don't have much experience of what you are trying to do. :oops:
djceejay
Studying :: BSc Computer Games Technology :: UK
one_eddie
Posts: 4
Joined: Wed Apr 20, 2005 10:30 am

Post by one_eddie »

I don't think you can mix compile types. I think the Irrlicht library you are using is in Release build and the program you are compiling is in Debug build.
They both are in debug mode.
This is just a guess - I don't have much experience of what you are trying to do.
So, how can i link a Irrlicht static lib to my app? So everything is fine?
rnodal
Posts: 5
Joined: Sun Feb 04, 2007 10:25 pm

Post by rnodal »

drac_gd
Posts: 132
Joined: Sun Apr 09, 2006 8:43 pm

Post by drac_gd »

In your irrlicht lib properties dialog
select Configuration Active( Debug )
set C/C++ -> CodeGeneration -> Runtime Library to Multi-Theaded Debug so that the library that is generated has the debug information in it.

When I build my irrlicht library In Active( Debug ) the
librarian -> output is set to ../../../Libs/win32/IrrStaticD.lib

in Active( Release )
librarian -> output is set to ../../../Libs/win32/IrrStatic.lib

then in my application project
for Active( Debug )
Linker -> input -> Additional Dependencies add IrrStaticD.lib

for Active( Release )
Linker -> input -> Additional Dependencies add IrrStatic.lib

this way the library does not need rebuilt each time you switch whether you are building a release or debug build

also if you have added irrlich to your application workspace then
right click you project and select Project Dependencies and then
check the box for irrlich.. this will cause the irrlicht project to be built before your application project attempts to link to it.

One more thing.. I see ;_USRDLL in your application preprocessor defines
this probably means your application is set use mfc as a dll.. this should work but it means that others who run your application must have the mfc dll installed.. You may want to try the Use of MFC -> Use MFC in a Static Library setting.. if you get this to work then your whole application will be in one exe
drac_gd
Posts: 132
Joined: Sun Apr 09, 2006 8:43 pm

Post by drac_gd »

hybrid,
could we get the defines posted in this thread added to irrlicht in IrrCompleConfig.h?
This would help out those of us that statically link :D
alternatively you could add these

Code: Select all

#ifdef _IRR_WINDOWS_

// Windows Only DLL export definition
#if defined(_IRR_WINDOWS_) && !defined(_IRR_STATIC_LIB_)
#	ifdef IRRLICHT_EXPORTS
#		define IRRLICHT_API __declspec(dllexport)
#	else
#		define IRRLICHT_API __declspec(dllimport)
#	endif // IRRLICHT_EXPORT
#else
#	define IRRLICHT_API 
#endif // _IRR_WINDOWS_

either one would be great :D
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, it's in the SVN now. Is there also a need to change stdcall or cdecl?
drac_gd
Posts: 132
Joined: Sun Apr 09, 2006 8:43 pm

Post by drac_gd »

Yes, it's in the SVN now. Is there also a need to change stdcall or cdecl?
I dont believe there is a need .. at least not for my project.

Thanks hybrid for adding to SVN :D
Post Reply