[SOLVED] VS2010 project from scratch

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
kiel814
Posts: 37
Joined: Mon May 23, 2011 4:30 pm

[SOLVED] VS2010 project from scratch

Post by kiel814 »

Hi, I want to create a VS2010 Irrlicht project from scratch outside the irrlicht folder.

I extracted irrlicht 1.8 to C:\irrlicht-1.8
I created a new project in C:\repos\test\test.vcxproj
It is an empty console project
I went to Project > Properties > Configuration Properties > VC++ Directories
and added C:\irrlicht-1.8\include to Include Directories
and C:\irrlicht-1.8\lib\Win64-visualStudio to Library Directories
I created a single file (main.cpp) and added it to the project.
The contents of the file:

Code: Select all

#include <irrlicht.h>
 
using namespace irr;
using namespace video;
using namespace core;
 
void main()
{
    IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<u32>(512, 384));
}
But when I try to run it I get the following error:

Code: Select all

1>main.obj : error LNK2019: unresolved external symbol __imp__createDevice referenced in function _main
I also tried adding the following preprocessor directives:

Code: Select all

#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
 
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
I'm not sure wha they are for, I just tried them because I saw them in other projects.
But anyway, they did not help.

So can anyone help me? What am I missing?

Regards!
Last edited by kiel814 on Fri Mar 01, 2013 2:35 pm, edited 1 time in total.
Vir
Posts: 14
Joined: Thu Feb 21, 2013 10:00 pm

Re: VS2010 project from scratch

Post by Vir »

You're best off modifying an existing Irrlicht demo. It'll have all the include files and lib files already linked to it, and all the solution and project properties will be set up properly. You're not really gaining anything by creating a project from scratch, especially if you don't know your way around Visual Studio yet.

To answer your problem, you don't have the Irrlicht include and lib files linked to your project, apparently, or your project doesn't know where to look for those files. I don't have Visual Studio on this computer right now, but you have to change the options in your project properties.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: VS2010 project from scratch

Post by serengeor »

kiel814 wrote: I went to Project > Properties > Configuration Properties > VC++ Directories
and added C:\irrlicht-1.8\include to Include Directories
and C:\irrlicht-1.8\lib\Win64-visualStudio to Library Directories

*****************************

So can anyone help me? What am I missing?

Regards!
Well first check if the library is in that path "C:\irrlicht-1.8\lib\Win64-visualStudio", library may have not been built for 64bit target.
And setting the path isn't enough, you also need to specify that you want to link with irrlicht library. I don't remember where to specify this in MSVS though, it should be somewhere near where you set the directory.
Working on game: Marrbles (Currently stopped).
kiel814
Posts: 37
Joined: Mon May 23, 2011 4:30 pm

Re: VS2010 project from scratch

Post by kiel814 »

Got it to work.

What I was missing was to copy C:\irrlicht-1.8\bin\Win32-VisualStudio\Irrlicht.dll to the project folder.

And this directive was indeed necessary:

Code: Select all

#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
BTW, I'm trying in another PC now and I am using Win32 version of the lib and the dll. I'll try again with the 64bit version of both files when I get back home.

Thanks Vir and Serengeor for your assistance.
Regards!
Kiel
Post Reply