MSVCR90.dll isn't found {was:[Solved] C++ File Inclusion :(}
Moderator: Coders of Rage
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
MSVCR90.dll isn't found {was:[Solved] C++ File Inclusion :(}
Here's my dilemma.
I have an engine class which stores all me requisite variables( video, input etc. )
but all the classes contained in the engine must include the engine in order to know what the engine is
int order to do things like debugging( which is handle by a debug class in engine ). Mainly just debugging. Because right now I use an extern statement to always have access to the engine object which is declared in main.cpp. I'm wondering if there's some way to easily fix this or
if I'm going to have to figure out... *gulp* the 'singleton technique'?
I have an engine class which stores all me requisite variables( video, input etc. )
but all the classes contained in the engine must include the engine in order to know what the engine is
int order to do things like debugging( which is handle by a debug class in engine ). Mainly just debugging. Because right now I use an extern statement to always have access to the engine object which is declared in main.cpp. I'm wondering if there's some way to easily fix this or
if I'm going to have to figure out... *gulp* the 'singleton technique'?
Last edited by RandomDever on Thu Aug 02, 2012 3:50 pm, edited 2 times in total.
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
- Nokurn
- Chaos Rift Regular
- Posts: 164
- Joined: Mon Jan 31, 2011 12:08 pm
- Favorite Gaming Platforms: PC, SNES, Dreamcast, PS2, N64
- Programming Language of Choice: Proper C++
- Location: Southern California
- Contact:
Re: C++ File Inclusion :(
Don't use a singleton. If your subsystems need a way to access the engine, give them a pointer or a reference. Better yet, isolate what parts of the engine they need access to (other subsystems, etc) and only give them pointers/references to those. Something like this would work:
Engine.hpp:
Engine.cpp:
VideoSystem.hpp:
VideoSystem.cpp:
AudioSystem.hpp:
AudioSystem.cpp:
InputSystem.hpp:
InputSystem.cpp:
I would recommend using references instead of pointers. Pointers should only really be used when null is a possibility. You will always have an Engine in your subsystems, so you could use a reference instead. There are a few other things about this code that I wouldn't advise you follow exactly, but this is just an example to give you an idea.
My main recommendation is to pass around specific members of the Engine class whenever possible, rather than the entire thing. If a class only needs access to your texture manager, you should only give it a reference to the texture manager, not the entire engine that happens to contain a texture manager. It's a bit more work, but your code will be better for it.
Edit: I forgot to mention why this code works. It uses forward declarations to avoid a circular header dependency. If a class's declaration only contains a reference or a pointer to another class, you only need to state that the type is a class for the code to compile. You will need to include the header in which the reference/pointer's class is declared in any source files that actually use it.
Engine.hpp:
Code: Select all
#pragma once
#include "AudioSystem.hpp"
#include "InputSystem.hpp"
#include "VideoSystem.hpp"
class Engine {
VideoSystem* _video;
AudioSystem* _audio;
InputSystem* _input;
public:
Engine();
~Engine();
VideoSystem* getVideo() { return _video; }
AudioSystem* getAudio() { return _audio; }
InputSystem* getInput() { return _input; }
};
Code: Select all
#include "Engine.hpp"
Engine::Engine()
{
_video = new VideoSystem(this);
_audio = new AudioSystem(this);
_input = new InputSystem(this);
}
Engine::~Engine()
{
delete _input;
delete _audio;
delete _input;
}
Code: Select all
#pragma once
class Engine;
class VideoSystem {
Engine* _engine;
public:
VideoSystem(Engine* engine);
Engine* getEngine() { return _engine; }
};
Code: Select all
#include "VideoSystem.hpp"
#include "Engine.hpp"
VideoSystem::VideoSystem(Engine* engine) : _engine(engine)
{
// Initialize video system...
}
Code: Select all
#pragma once
class Engine;
class AudioSystem {
Engine* _engine;
public:
AudioSystem(Engine* engine);
Engine* getEngine() { return _engine; }
};
Code: Select all
#include "AudioSystem.hpp"
#include "Engine.hpp"
AudioSystem::AudioSystem(Engine* engine) : _engine(engine)
{
// Initialize audio system...
}
Code: Select all
#pragma once
class Engine;
class InputSystem {
Engine* _engine;
public:
VideoSystem(Engine* engine);
Engine* getEngine() { return _engine; }
};
Code: Select all
#include "InputSystem.hpp"
#include "Engine.hpp"
InputSystem::InputSystem(Engine* engine) : _engine(engine)
{
// Initialize input system...
// Maybe you'd use _engine->getVideo() to get an input source from the window
}
My main recommendation is to pass around specific members of the Engine class whenever possible, rather than the entire thing. If a class only needs access to your texture manager, you should only give it a reference to the texture manager, not the entire engine that happens to contain a texture manager. It's a bit more work, but your code will be better for it.
Edit: I forgot to mention why this code works. It uses forward declarations to avoid a circular header dependency. If a class's declaration only contains a reference or a pointer to another class, you only need to state that the type is a class for the code to compile. You will need to include the header in which the reference/pointer's class is declared in any source files that actually use it.
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: C++ File Inclusion :(
Code: Select all
struct Time
{
unsigned short int year;
std::string month, dayOfWeek;
unsigned short int day, hour, minute, second, millisecond;
};
Code: Select all
'struct' type redefinition
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
- bbguimaraes
- Chaos Rift Junior
- Posts: 294
- Joined: Wed Apr 11, 2012 4:34 pm
- Programming Language of Choice: c++
- Location: Brazil
- Contact:
Re: C++ File Inclusion :(
That's probably an include guard problem. It is being redefined because you include it in more than on file.
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: C++ File Inclusion :(
Thank you bbguimaraes it was.
I mispelled utilities on the define. Well back to work.
I mispelled utilities on the define. Well back to work.
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: C++ File Inclusion :(
On a side note.
Does anyone know how to detect a window resize event for Microsoft Windows?
And handle them.
Does anyone know how to detect a window resize event for Microsoft Windows?
And handle them.
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
- Nokurn
- Chaos Rift Regular
- Posts: 164
- Joined: Mon Jan 31, 2011 12:08 pm
- Favorite Gaming Platforms: PC, SNES, Dreamcast, PS2, N64
- Programming Language of Choice: Proper C++
- Location: Southern California
- Contact:
Re: C++ File Inclusion :(
WM_SIZE message:RandomDever wrote:On a side note.
Does anyone know how to detect a window resize event for Microsoft Windows?
And handle them.
Code: Select all
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
// ...
case WM_SIZE: {
// If you anticipate sizes of more than 65535, use GetClientRect instead
int w = LOWORD(lParam);
int h = HIWORD(lParam);
// Handle the resize. Ex:
//glViewport(0, 0, w, h);
return 0;
}
// ...
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
-
- Chaos Rift Cool Newbie
- Posts: 85
- Joined: Thu Jun 23, 2011 11:12 am
Re: C++ File Inclusion :(
I'm really confused.. I can't think of any reason a subsystem of your engine would need access to the engine for? Can you explain for me please?
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: C++ File Inclusion :(
I'm using SDL.
How do I make it so that it doesn't have black boxing when resizing?
How do I make it so that it doesn't have black boxing when resizing?
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
- Nokurn
- Chaos Rift Regular
- Posts: 164
- Joined: Mon Jan 31, 2011 12:08 pm
- Favorite Gaming Platforms: PC, SNES, Dreamcast, PS2, N64
- Programming Language of Choice: Proper C++
- Location: Southern California
- Contact:
Re: C++ File Inclusion :(
Wherever you're pumping SDL_Events:RandomDever wrote:I'm using SDL.
How do I make it so that it doesn't have black boxing when resizing?
Code: Select all
if (ev.type == SDL_VIDEORESIZE) {
// ... use data in ev.resize ...
}
I don't think there is a way to eliminate the black boxing while using SDL. It would require intercepting the WM_SIZING event and redrawing between mouse movements, which can slow things down.
Simple questions like this can be answered by using Google or RTFM. SDL 1.2 docs are at http://sdl.beuc.net/sdl.wiki/FrontPage, SDL 2.0 docs are at http://wiki.libsdl.org/moin.cgi/FrontPage.
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: C++ File Inclusion :(
Does anyone know where SDL sets up the window ( in the code )?
If they use the windows API I may be able to modify SDL to do my bidding.
If they use the windows API I may be able to modify SDL to do my bidding.
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
- bbguimaraes
- Chaos Rift Junior
- Posts: 294
- Joined: Wed Apr 11, 2012 4:34 pm
- Programming Language of Choice: c++
- Location: Brazil
- Contact:
Re: C++ File Inclusion :(
In my experience, if you ask that question, you are not on the level to do it (no offense). Otherwise, grep is your friend.RandomDever wrote:Does anyone know where SDL sets up the window ( in the code )?
If they use the windows API I may be able to modify SDL to do my bidding.
But keep in mind you're going to loose much of the portability (if not all) that you gain by using SDL.
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: C++ File Inclusion :(
I have an application called PRGrep and I searched for various things within SDLs code that would be required for setting up a window.
No results.
I see SetVideoMode declared but not defined.
How exactly is that possible?
Is it in the DLLs?
In that case how am I supposed to edit it?
LATER: OK so I figured out I had to download the SDL source and dig through it to find the WndProc definition.
It's on Line 251 in SDL_sysevents.c.
So I've modified it to do my bidding *evil laugh* and rebuilt SDL.dll.
It works the way I intended except for one thing.
The window is updating slowly so if I call glClear it will clear the screen after a second but it is not perfectly filling the window (still minor black boxing).
I checked and minecraft has the same type of problem when resizing.
Does anyone know a way to fix this?
No results.
I see SetVideoMode declared but not defined.
How exactly is that possible?
Is it in the DLLs?
In that case how am I supposed to edit it?
LATER: OK so I figured out I had to download the SDL source and dig through it to find the WndProc definition.
It's on Line 251 in SDL_sysevents.c.
So I've modified it to do my bidding *evil laugh* and rebuilt SDL.dll.
It works the way I intended except for one thing.
The window is updating slowly so if I call glClear it will clear the screen after a second but it is not perfectly filling the window (still minor black boxing).
I checked and minecraft has the same type of problem when resizing.
Does anyone know a way to fix this?
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: C++ File Inclusion :(
Well it's okay I'll blank the screen on resize.
Marking as solved.
Marking as solved.
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: [Solved] C++ File Inclusion :(
Just curious if there are still people monitoring this forum.
What is a good FPS for rendering 2500 textures to the screen?
What is a good FPS for rendering 2500 textures to the screen?
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip