Sign in to follow this  
AndyEsser

Problem with Visual Studio 2008 when rewriting engine

Recommended Posts

AndyEsser    394
Hi all, I've been fairly quiet the last few months, just been busy with work and things and anyway it's come time for me to get back into OpenGL. Now I'm wanting to start mostly from scratch because I've redesigned how I want my engine to be, howver I'm coming across a problem and feeling like a complete noob. Basically, I want to have a solution in Visual Studio that contains two projects. The first is the DLL I'm developing for the engine itself. The 2nd is a simple test app, that references the DLL and can call the classes/functions within it. However, I'm stuck. I've created the solution but regardless of what settings I change (References, Project Dependencies, Additional Libs, etc) I just can't seem to get this work. When I'm in the project that is the demo app, intellisense will provide me with all the classes that are in the DLL but when I try and compile it just returns "Undeclared Identifer" when I'm trying to declare the class in the demo. What am I doing wrong!?!?! Thanks,

Share this post


Link to post
Share on other sites
jpetrie    13138
Quote:

Surely for a DLL you don't have to include a header, isn't that just for .lib (static libs)?

DLL and libraries mean nothing to a C++ compiler (it's the linker that would deal with them). The compiler needs to know about the declarations and definitions of various things exposed by the external code. That typically means including the header files that declare or define those entities.

If you're not including those headers, that's certainly going to be a problem. You might have others as well, though -- but that will definitely be a problem. You should read this if you have not already.

If it still doesn't compile after you add the appropriate includes, why don't you paste your code that doesn't compile and detail the errors?

The nature of your issue suggests you don't know much about DLLs and how they operate, which begs the question "why are you even using one?"

Share this post


Link to post
Share on other sites
K1nG Gr4H4m    100
Maybe missing something like this:

#ifdef MYENGINEDLL_EXPORTS
#define MYENGINEDLL_API __declspec(dllexport)
#else
#ifdef MYENGINEDLL_STATIC_LIB
#define MYENGINEDLL_API
#else
#define MYENGINEDLL_API __declspec(dllimport)
#endif //MYENGINEDLL_STATIC_LIB
#endif


and then you add it in front of your class like:

class  MYENGINEDLL_API MyClass : public Node
{
...
}


Just add MYENGINEDLL_EXPORTS in preprocessor definitions in your dll and it should be ok.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this