Irrlicht in a c++ WinForms App

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
chaoslion
Posts: 25
Joined: Sun Oct 30, 2005 1:44 pm

Irrlicht in a c++ WinForms App

Post by chaoslion »

Hey Guys

i was just trying to create a device in a WinForms application but the
linker throw two error:

Code: Select all

rrlicht.h(303) : warning C4272: 'irr::createDevice' : is marked __declspec(dllimport); must specify native calling convention when importing a function.

irrlicht.h(314) : warning C4272: 'irr::createDeviceEx' : is marked __declspec(dllimport); must specify native calling convention when importing a function.
i was about to create the device in the OnLoad event.. heres the beginning..:

Code: Select all

#pragma comment( lib, "irrlicht.lib" )
#pragma once

#include <irrlicht.h>



namespace configdlg {


	using namespace Irrlicht;

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void) { .......};
so what do the linker error messages mean?
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

I think you should use IrrLicht.Net for WinForms.
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

Post by lug »

Magnet wrote:I think you should use IrrLicht.Net for WinForms.
Yup, I would have to agree with you on this one. I use winforms heavily in irrShowMesh:

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=16168

Since winforms is part of .NET, I would use .NET version of Irrlicht.
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

Add this to your project's preprocessor definitions:

Code: Select all

IRRCALLCONV=__stdcall 
I dunno. Might work...
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
execute
Posts: 14
Joined: Wed Nov 22, 2006 7:48 pm

Post by execute »

Don't use .NET, unless you want to download the .NET framework for all your users.

Windows is easy enough with C++ purely, your linker error has nothing to do with using or not using .NET.
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

What is the problem with mixing WindowsForms and Irrlicht native ? :roll: How do you think the official wrapper was made if not by mixing both .NET and Irrlicht native ?
Using a .NET wrapper with C++ would be suicide (even if you are using .NET) :roll:

Just replace :

Code: Select all

#include <irrlicht.h> 
by

Code: Select all

#pragma unmanaged
#include <irrlicht.h> 
#pragma managed
And it should work (if it does not, try zenaku's solution and check if the irrlicht.h used is the right one).
Don't use .NET, unless you want to download the .NET framework for all your users.

Windows is easy enough with C++ purely, your linker error has nothing to do with using or not using .NET.
What if he already uses .NET in his software ? Take a look at his namespaces, I'd bet it's not native.
And also, to use .NET is not just to force users to have the framework... It's often a development choice you know :roll: (moreover, I think you did not take a look at all the softwares that require the framework now... Most of drivers like ATI's or HP printers', games such as Neverwinter Nights, Titan Quest... I'd bet only few users will need to download the framework).
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
Post Reply