C++ Blitzer help wanted

Miscellaneous Forums/General Discussion/C++ Blitzer help wanted

...hi guys..i would like to ask for help here since I didnt get it from original forum where I use to post my question..I mean I did receive answer but it was general and didnt helpme at all...im not C++ fanboy so, I really need help with this..I recently discovered Horde3D engine and use to read documentation provided with it..I download it and try to run, and of course things not working..I asked on Horde forums how to set up properly this thing but they said everything is in Knight sample source so just load it and it should run, whats not happen since I got a lot of link error messages..so, maybe you ask yourself why im bothering with something I even dont know how to set up(logical question)..well..answer is that this is a first 3D renderer using C++ that I was able to really clearly understand source code of provided examples...I mean, I didnt succeed with running it, but source code I saw I really understand what each command suppose to do, so i have decided to play with it a bit...so, bottom line is, I wanted to ask some of you here whos familliar with C++ to explain me how to set up this thing properly (empty project ready for my code) ? I hope someone will find it interesting and help me out with this..thanks guys and Im sorry for asking such question on B3D forum...I hope moderators will be gentle.. :)

Usually, setting up a library in your project in C++ is done something like this:

1. Find the library's "lib" folder (or whatever it's called) - this folder will contain one or more .lib files
2. Find the library's "include" folder (or whatever it's called) - this folder will probably contain several .h files
3. In your IDE, add the above lib folder to the linker's list of input paths, and add the names of the .lib files to the linker's list of input libraries (note that often there will be separate .lib files for debug and release modes)
4. In your IDE, add the above include folder to your compiler's list of input paths.
6. If you created a blank project to be used for a game, you'll probably want to setup C++ optimizations at this point, since most aren't enabled by default.
7. Try compiling something. Hopefully, it should now.
8. If your library uses DLLs, you'll have to make those available to the compiled EXE's. Usually this is just a matter of copying the appropriate .dll files into your EXE's folder.

If you can't get it to compile with the above steps, it could be that the project isn't compatible with your compiler (although this should be rare).

It may seem complicated, but it really isn't once you get used to it. Basically you just need to point the compiler to the library's include files, and the linker to the library's .lib files (if you don't do this, you'll get tons of linker errors).

Here's why: The include files act like templates for all the functions, etc. you can call - without them you won't be able to call a function from your C++ code because the compiler won't know the proper function names, parameters, etc. The .lib files contain the actual compiled code which the include files are referencing, so it's important that your linker knows where to locate these files - otherwise the linker will give you a lot of errors because it can't find the actual executable code for functions that you're calling.

..hey John.J..thank you for kind reply..Im using Visual C++ 2005 express edition...I cant see any option where I can enter infor you mentioned...only option I can see some settings is available is Tools-->Options but still cant see any linker in/ot settings etc..can you provide a bit more details, please??

@Naughty

There's a graphical guide to set up for VC++ 2005 Express, although it's in Japanese, you can still understand what it means by the image:

http://selene-lue.halfmoon.jp/index.php?Visual%20C%2B%2B%202005%20Express%20Edition%E3%81%AE%E8%A8%AD%E5%AE%9A%E6%96%B9%E6%B3%95

It's an easy guide to setup up that.

BTW, you can consider to upgrade to VCExp2008, as the PlatformSDK has already come with 2008 edition which saves you a little time.

hmm..it seems that this version of Visual C++ im using doesnt support project solutions....crap...what to use then??

Well, it's in somewhere hard to find in VCExp2005, you may want to expand the trees to find out, it's somehow took me time to find them in the Tool\Option dialog.

Have changes to VCExp2008 so I can't figure the exact place, however the .vcproj created by 2005 can work on 2008, the compiler works as it is in 2005.

Im downloading VCExp2008..I hope this will work..I really want to play with this thingy...

I used to use Visual C++ 2005 Express a lot before I got Standard, so I know it does support projects and solutions, you just may not understand them.

Setting the linker / compiler setting in the Tools\Options dialog will work, but you shouldn't do it this way - the options found there are "global" includes/libs that will be used in every project. While this would be convenient if you develop C++ programs with nothing but that library, the "proper" way is to set up is in the project options.

Here's how:

1. Once you have a project open, find the "Solution Explorer" window. This window should contain all the projects in your currently opened "solution" file (often you'll just have one project). Right-click on your project (should be the second item down - it should have a +/- icon near it since you can expand/collapse it's contents), and select "Properties".

2. Now that you have your project's property pages open, expand the "Configuration Properties" on the left. Now expand the "C/C++" section and select "General". On the right there should be an "Additional Include Directories". Click on it and click the "..." button to the right to open the directory editor, and add the include path to your lib.

3. Now you can collapse the "C/C++" section and expand the "Linker" one. Select the "General" page, and look for "Additional Library Directories" on the right. This is where you specify your "lib" directory.

4. Next, select the "Input" page, and click on the "Additional Dependencies" property. Here you should type the names of all the .lib files that your exe will use, separated by a space.

5. In the top-left corner of the property dialog, you should see a drop-down that contains either "Release" or "Debug". If it says Release, you'll have to select Debug and repeat steps 2-4. If it says Debug, you'll have to select Release and repeat steps 2-4. Note that when configuring Debug mode in step 4, you may need to specify a debug version of the .lib files, usually identified with a "_d" added to the filename - for example there might be "engine.lib" (for Release) and "engine_d.lib" (for Debug).

Step 5 is probably the only thing I can find tedious about configuring a project - you have to configure it twice, basically, for both compile modes. But in a way this is good, since you can control exactly how you want each mode built.

Learning how to use the property dialog of Visual C++ is probably the most important part of using libraries. It takes a little getting used to, but once you master it, it's easy to use any C++ library you want.

Im downloading VCExp2008..I hope this will work..I really want to play with this thingy...

Yeah, I forgot to mention that if you're using VC++ 2005, you'll probably have to install and configure the Microsoft Platform SDK first.

However, I think Visual C++ 2008 doesn't work flawlessly with all libraries in Release mode, so you may have to use VC++ 2005 & the Platform SDK if 2008 doesn't work with Horde (or wait until Horde3D is updated for VC++ 2008)

..hey John..thank you for your time...have you download and try Horde3D, including compiling given samples with success? In step (2) I cant get menus you mentioning and I have no idea whats wrong..I just download and install VC++2008..this is really weird..

I just tried Horde3D, and all I did was this:

1. Extract Horde3D somewhere.
2. Go into the Horde3D SDK folder.
3. Double-click on Horde3D.sln
4. Press F5, wait for it to compile, and watch it run.

The Horde3D samples work just fine here.

One thing I noticed was that the Horde3D library doesn't come precompiled - only the source is included. This means that if you had opened only the .vcproj files of the samples, it wouldn't work because Horde3D wouldn't be compiled automatically as it is with the .sln file.

Edit: I just tried Horde3D with Visual C++ 2008 Express, and it worked just as well (the only difference is that VC++ 2008 will upgrade the solution and project files when you first open it, since they were originally from VC++ 2005).

..I did same..
1.) Done
2.) Done
3.) I got this message on screenshot...WTF !



From your task bar, it looks like you're using Horde3D 0.11.1. I downloaded 0.13.0 here - maybe it will work if you try that.

The error you're getting is because the Express editions of Visual Studio don't support something called "Solution Folders", which I think allows you to categorize your solution file's projects in the Solution Explorer. Later versions of Horde3D probably stopped using this feature because of these problems with Visual Studio Express.

Hi, John, what the release problem if I let the VC2008 to compile a VC2005 project? My current project relies on a few 3rd party lib(Zlib, PNG, FreeType, ODE), if that may cause potential problems I may consider roll back....

hey John...thank you buddy...its working like a charm now...if you were around, I'll call you for drink for this..thank you for patience with my stupid questions...thanks man, I really mean it..

Naughty Alien: Glad I could help :)

yoko: The only problems I heard of were when VC++ 2008 linked with libs compiled with a previous version of Visual C++ (2005), since VC++ 2008 uses a new runtime (not sure about the details though).

As long as you recompile all your 3rd party libs in VC++ 2008, you shouldn't have any problems. If you don't have the source, then first try running debug and release mode - if they work, then you should be fine, if not, you may have to roll back.