Page 2 of 2

Posted: Mon Jul 24, 2006 7:46 am
by zeno60
Yeah, DevCpp, although technically beta is a great compiler.

But if you are sticking with VC++, I found that the Hello World tutorial contains a tutorial.html file which goes through "Setting up your IDE" and the first section is "If you use Version 6.0 MSVC." Perhaps you could give this a read?

Comes with screenshots, so i'd definetly take a look, but this is what it says:
If you use Version 6.0, select the Menu Extras -> Options. Select the directories tab, and select the 'Include' Item in the combo box. Add the \include directory of the Irrlicht Engine folder to the list of directories. Now the compiler will find the Irrlicht.h header file. We also need the location of irrlicht.lib to be listed, so select the 'Libraries' tab and add the \lib\VisualStudio directory.
But if you decide to go ahead with dev, the Irrlicht/DevCpp Tutorial will get you up and coding in no time. Good luck.

Posted: Mon Jul 24, 2006 8:04 am
by abecks
Well actually I cant get anything to compile on Dev C++... to I guess nevermind that one.

The tutorial on the Irrlicht website for DevC++ is extremely out of date, alot of the files are different.

Posted: Mon Jul 24, 2006 8:06 am
by vitek
The link error is because you are #including driver.cpp into main.cpp. The symbol is defined in both the main.obj and driver.obj compiled modules, and the linker doesn't know which one to choose.

Normally you would make a driver.h that would have the declaration for you getDriver function. Then driver.cpp would have the definition.

Travis

Posted: Mon Jul 24, 2006 8:55 am
by abecks
Think you can give me a hand setting that up? Im thinking I include the header file from main.cpp but I am not sure what to declare inside the header file and what to remove from the other files.

Posted: Mon Jul 24, 2006 10:32 am
by vitek
The function declaration goes in a header...

Code: Select all

// driver.h
#ifndef _DRIVER_H_INCLUDED__
#define _DRIVER_H_INCLUDED__
#include <irrlicht.h>
irr::video::E_DRIVER_TYPE askDriver();
#endif // _DRIVER_H_INCLUDED__
The function definition goes in a source file...

Code: Select all

// driver.cpp
#include <driver.h>
irr::video::E_DRIVER_TYPE askDriver() 
{ 
   printf("Please select the driver you want for this example:\n"\
   //...
}
You include the header, and you link the two .obj or .o files that are generated when you compile the source files...

Code: Select all

// main.cpp
#include <irrlicht.h> 
#pragma comment(lib, "Irrlicht.lib") 

#include "driver.h" 

using namespace irr; 

int main() 
{
  //...
}
For something as simple as you are doing, you're sure making it difficult. The simple solution would be to just put the askDriver() function definition just above main().

Posted: Mon Jul 24, 2006 11:49 am
by abecks
Thanks for all the help. :) I was just doing it because I know my main.cpp file is going to end up being a mile long, and Im trying to avoid that. Im used to programming in C for MUDs, and the file seperation for all the various tasks. But thank you so much for taking the time to help.

Posted: Mon Jul 24, 2006 12:13 pm
by hybrid
But it's the very same in C :!: Only difference is that class definitions may contain code in .h files as this only becomes active upon instantiation. But all the rest is really the same.