Working directories?

Started by
8 comments, last by CadetUmfer 12 years, 10 months ago
I'm using Ogre and to get the project working i have to set the working directory to ogre's dlls and resources.

However i also need to load my own resources. And since the working directory is not at my project's home, i need to either place my data in ogre's files, or place them in my project and provide a full path which won't work since others will be using the project.. So how do i handle this?

Also, a slightly noobish question, what is the difference between a dll, lib, and source/header files??? I googled but didn't understand!
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "
Advertisement
Sorry to sound harsh, but if you don't know about source, headers and library files, you should learn the language before jumping in a full blown 3d engine.

Sorry to sound harsh, but if you don't know about source, headers and library files, you should learn the language before jumping in a full blown 3d engine.


Quoted for truth. You need to learn how to walk before you can run. Take a big step back and learn at least the basics of software development before you start jumping into game development.

Hero of Allacrost - A free, open-source 2D RPG in development.
Latest release June, 2015 - GameDev annoucement

While I totally agree with the previous comments, I'll add that you aren't setting your IDE up properly. Your working directory is where anything for your game and your resources are contained, any external libraries you want to reference can be done in the options of your IDE.
So how can i make VS use the dlls in the ogre directory without setting it as my working directory?

By the way, my problem is that i'm a quick learner, i jumped head first and missed a lot of basic stuff. For example, i made a 2D RPG, my 3D FPS game is half-done, and i'm currently working on a procedural tree generator for a MORPG (not massive :) ). A year ago i had zero programming knowledge.

So while now i'm pretty good at c++ and graphics rendering (D3D, not OGRE.. i hate that thing), i'm ignorant of a LOT of programming aspects. For example, i only found out what makefiles are yesterday..

Edit: I know what source and header files are. I just don't understand what libraries and dlls are for. I've linked to libraries before (obviously..), but i have no idea what they are..

Edit2: I realize how (stupid?) my position is, but it's just how i do things..
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "
I partially took that approach of jumping ahead and "quick learning" only to regret it years later. It's really nice to get good results quickly in terms of motivation, but if you focus on making stuff work "today" then in a few months time you will need to extend your application and you will see you missed out on proper object design, data flow, rendering optimizations etc. This will lead to a lot of frustration and you'll end up hating yourself. There's a reason programming is a lot about being neat, logical, having a clear detailed plan, and object oriented, and not about making thigs working in just a few days and not worrying about tomorrow. It's an ok approach for prototyping but not for coding in general. You need to take a few steps back and learn a lot about how to design your objects, and look at how other people do it.

To answer your question, libs are essentially DLLs when they are compiled. A DLL is same as an exe (in that it's code that you compiled), only it contains various functions which you can call from the main project (the executable when compiled) and it cannot run on its own. So when you add a library to your project, you add access to the functions this library provides. When compiled, the exe can use the functions within the dll when it's running.
Lib = statically-linked library of compiled code
Dll = dynamically linked

Compiling a dll will also compile a lib containing the import data (function offsets) for your dll that you statically link with projects that use said dll.
Thanks :)

However my first question is still unanswered. Here's what i'm asking:

I have a project that uses OGRE. In order for it to run, i have to set the following:
Command: $(OGRE_HOME)\Bin\$(ConfigurationName)\$(ProjectName).exe
Working Directory: $(OGRE_HOME)\Bin\$(ConfigurationName)

Now as i understand it, these will both execute the exe file and put my default directory in Ogre's bin folder. I don't want that. I want to have VS run the exe that's in my project's directory. I also don't want to have my default directory in OGRE's folders, since i'd have to place MY game data there too, or give full paths to them and place them in my project's folders.

Now if i change these to the default values, the linker will complain about missing dlls. I know i can copy them and place them next to my exe, but is there a way where i can link to them in OGRE's directory the same way i link to libs??
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "
I understand where people are coming with this "go learn the basics first" but I have to disagree.
I've studied programming, and game programming in several places. And they don't stop to tell you how to install and use a big library like this.
They never teach you how to use subversion even if it's used everywhere... or any type of version control.
They never teach you to use external files to save configurations, or in the case of games, how to script your game with external files.
I never even heard about programs that auto-document the code for you, like doxygen. Or how to use the boost library, or how to make an installer for your program.

Even though these are all basic and very useful and used everywhere... but no, what they teach is UML and crap like that that hardly anyone uses.

You can easily make a full game without knowing all the compiler options, that doesn't mean you should go back and learn all the options the compiler and your IDE have before starting to program.
Also, this is the "For Beginners" forum, if a google search doesn't help, I think this is the right place to ask such a question.

Sorry for the rant. And sorry op for not dealing with your question, but I don't have the answer for I am also a noob. And I'll probably be a noob forever.
EDIT: Misunderstood what you were asking. What you want to do is create a Post-Build event that copies the dlls from the Ogre project's output directory into your project's working directory.

Also maybe reconsider including the Ogre project in your solution. The thing's massive, you'll probably save a lot of time by just using the lib/dll/headers.
Anthony Umfer

This topic is closed to new replies.

Advertisement