C++ note after my first experience

I have learned C, C#, Jave. I learn them by my intuition, not by reading bible books. So, maybe a little faulty. Anyway, here is my experience after using C++ with Irrlicht.

1. #include “” is different from #include <>

Quoted form : preprocessor to look for include files in the same directory of the file that contains the #include statement, and then in the directories of any files that include (#include) that file. The preprocessor then searches along the path specified by the /I compiler option, then along paths specified by the INCLUDE environment variable.

Angle-bracket form : preprocessor to search for include files first along the path specified by the /I compiler option, then, when compiling from the command line, along the path specified by the INCLUDE environment variable.

2. namespace, class definitions need ‘;’ after {}

3. keyword private: and public: to seperate two kinds of variables and methods, instead of these keyword in front of each variable and method. I remember this is C convention, am I right?

4. define class in .h and the implemention in .cpp. define only method prototype in class, implementation in .cpp later.

5. class->staticMethod and instance.instanceMethod. or pointer->method, instance.method.

These is what I notice its difference from C# and Java. C++ is a difficult but powerful language. learning and using C++ is funny.

Advertisements

Little Game with Irrlicht

Try to make a little game with Irrlicht engine.

Don’t have a paticular type of game in my head yet.

Maybe be start from a simple one then move on to Zuma like game.

Then once I am comfortable with Irrlicht, I will consider moving to OGRE or some other powerful engine.

This is going to take a reeeeeeeeeeeally long time.

If you have any idea of a simple little game, inspire me.

For now, an multiplayer RPG like ‘Battle Royale’ or the classic Tetris, maybe.

Load .dll in VS2008 using C++ (Irrlicht as example)

Recently kick start my game project, my friend says I should try Irrlicht, so I try it.

But I know almost nothing about C++, especially how to link stuff together.

I follow their tutorial and compile okay. I know this is more than stupid to feel happy about it.

But I am still going to make a note on this in case somebody like me whats to know about this simle thing.

First of all, if you want to use someone else .dll, you have to have the .h and the .lib to use the .dll.

.lib is for static methods and also as a portal to the .dll dynamic methods. .h is the header file.

So, all three have to link to your project. in this order: .h -> .lib -> .dll

Secondly, how does the IDE find those file, for the .h, you can do it in two ways, globally setup in the IDE or locally setup in the project, I choose the second one.

open the properties of the project, Go to Configuration -> C/C++ -> general. There is a place to add ‘other include directories’. Add your directory which contains the .h there. You may have to add a source with int main() and the compile it in order to see C/C++ option.

For the .lib, go to linker -> general -> ‘other libraries directories’, Add the directory which contains the .lib there.

And there are two ways to link .dll, I only know what the tutorial taught me. write this in you code.

#pragma comment(lib, "Irrlicht.lib")

then copy the .dll to your project source root and you are ready to go.