Corrosive

Member
  • Content count

    126
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Corrosive

  • Rank
    Member
  1. unknown error while linking

    Thx for the help mate.. it worked! I think i should pay more attention :)
  2. Hi folks.. Im getting a strange error here... dunno why its happenning, because I checked the includes and libs, everything... but i probably forgot something! Can you help me out? Compiling... WinMain.cpp Linking... LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main Debug/rpg.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. Thx!
  3. Im a little new to this stuff, so it could be wrong(90% chances hehehe), but i think you should try inheritance... Try to use this as a base and derive that class to other, so the other class will acess the private functions of the base class inside the functions and the client will only use the functions of the derived class, not the base class... I hope it works, didnt payed attention to my OOP classes at University lol!
  4. Hi there... Im trying to make some dll modules and work with abstract functions(interfaces). Its my first attempt so, maybe the question will be a little dumb, but im not used to OOP as i should be! Well, enough chit chat, the problem is that im receiving an "C2275" error message like that: c:\projetos\p1\anauelrender.h(41) : error C2275: 'CREATERENDERDEVICE' : illegal use of this type as an expression c:\projetos\p1\anauel.h(43) : see declaration of 'CREATERENDERDEVICE' And i think the problem is in the declaration, see below: extern "C" { HRESULT CreateRenderDevice(HINSTANCE hDll, AnauEngine **pInterface); typedef HRESULT (*CREATERENDERDEVICE) (HINSTANCE hDll, AnauEngine **pInterface); HRESULT ReleaseRenderDevice(AnauEngine **pInterface); typedef HRESULT (*RELEASERENDERDEVICE) (AnauEngine **pInterface); } and then defined as below: HRESULT AnauelRenderer::CreateDevice(char *chAPI) { char buffer[300]; if(strcmp(chAPI, "d3d") ==0) { a_Dll = LoadLibrary("anaueld3d"); if(!a_Dll) { MessageBox(NULL, "anaueld3d.dll falhou!", "Anauel - Erro", MB_OK | MB_ICONERROR); return E_FAIL; } } CREATERENDERDEVICE _CreateRenderDevice = 0; HRESULT hr; _CreateRenderDevice (CREATERENDERDEVICE) GetProcAddress(a_Dll, "CreateRenderDevice"); if(!_CreateRenderDevice) return E_FAIL; hr = _CreateRenderDevice(a_Dll, &a_Device); if (FAILED(hr)) { MessageBox(NULL, "CreateRenderDevice da dll falhou!", "Anauel - Erro", MB_OK | MB_ICONERROR); a_Device = NULL; return E_FAIL; } return S_OK; } I wanna know if there is something wrong about VC++ 6.0 with this type of casting, and what should i do to avoid that error? one more thing... i also used that: typedef struct AnauelRenderer *ANAUELRENDERER; and AnauelRenderer is a class, making the compiler generate this error also: c:\projetos\p1\anauelrender.h(20) : warning C4099: 'AnauelRenderer' : type name first seen using 'class' now seen using 'struct' c:\projetos\p1\anauelrender.h(4) : see declaration of 'AnauelRenderer' I just placed all of this because i think its all corelacioned. I hope you guys understand the mess i placed behind :)
  5. unresolved external error

    I defined the constructor as adviced, now all of the virtual functions are unresolved... Im a little new to abstract classes yet, thats why im getting all this trouble :) Trying to make my first Dll... One more thing... Im going to the bed folks, thx for all the help!!! Tomorrow i will take a look on this post, good night!
  6. unresolved external error

    c:\projetos\p1\anaueld3d.h(8) : error C2512: 'AnauEngine' : no appropriate default constructor available Error executing cl.exe. this is the error message and this: class anaueld3d : public AnauEngine { public: anaueld3d(HINSTANCE hDll){a_Dll = hDll;}; . . . //rest of the class body . . }; is the declaration of the constructor...
  7. unresolved external error

    Hi, well... just look at the abstract class(base class), the constructor is not virtual, its defined there. If i try to define the constructor anywhere else, it says that i dont have a apropriate default constructor. So, basically, i cant define it anymore. Its defined on the base class. The derived class dont need to define it again i think...
  8. unresolved external error

    *aDevice = new anaueld3d(hDll); its all about this line... if i get this line out, it stops showing the error... one more thing, its a link error, not a compiler error. I probably messed up with some pointers, because when it try to get a pointer for aDevice, it shows the error, when try to call the constructor!
  9. unresolved external error

    But anaueld3d is the constructor of the class derived from the base class(an abstract class). And i verified every declaration of the constructor and it means the HINSTANCE handle on every declaration. The only thing it dosnt appear to do is define the body of the constructor.
  10. unresolved external error

    Sorry for that... Well, the error message is that: anauel_Init.cpp c:\projetos\p1\anauel.h(36) : warning C4099: 'AnauEngine' : type name first seen using 'class' now seen using 'struct' c:\projetos\p1\anauel.h(6) : see declaration of 'AnauEngine' Linking... Creating library Debug/anaueld3d.lib and object Debug/anaueld3d.exp anauel_Init.obj : error LNK2001: unresolved external symbol "public: __thiscall anaueld3d::anaueld3d(struct HINSTANCE__ *)" (??0anaueld3d@@QAE@PAUHINSTANCE__@@@Z) Debug/anaueld3d.dll : fatal error LNK1120: 1 unresolved externals Error executing link.exe. i dont know exactly why its showing that!!!
  11. Hi guys... Im trying to make some Object Oriented Programming here. Im making a Dll and im using abstract classes. As i can see, the error points to the constructor of the derived class!!! I will place some code to clear any doubts! //anauel_init.h #include "anaueld3d.h" HRESULT CreateRenderDevice(HINSTANCE hDll, AnauEngine **aDevice) { if(!*aDevice) { *aDevice = new anaueld3d(hDll);//line possibly with error return 0; //return A_OK quando estiver implementado o controle de erros } return 1; } //anauel.h #define Max_Instances 8 class AnauEngine { protected: HWND a_HwndMain; HWND a_Hwnd[Max_Instances]; //limite de janelas de renderização UINT a_HwndCount; //número de janelas usadas UINT a_ActiveWindowId; // Identificação da janela ativa HINSTANCE a_Dll; //Usado para carregar a DLL DWORD a_largura; //largura da tela DWORD a_altura; //altura da tela bool a_Windowed; //tela cheia ou janela? char a_GpuId[256]; //Modelo da GPU FILE *a_Log; //Arquivo de log bool a_Ativo; //Verifica se o engine está rodando public: AnauEngine(HINSTANCE) {}; virtual ~AnauEngine(void)=0; virtual HRESULT Init(HWND) =0; //Inicializa o dispositivo para a janela solicitada virtual void Release(void) =0; virtual bool Ativo(void) =0; virtual HRESULT UseWindow(UINT Hwnd) =0; virtual HRESULT Render(bool ClearPixel, bool ClearDepth, bool ClearStencil) =0; virtual void StopRender(void) =0; virtual HRESULT Clear(bool ClearPixel, bool ClearDepth, bool ClearStencil) =0; virtual void SetClearColor(float Red, float Green, float Blue) =0; }; typedef struct AnauEngine *ANAUENGINE; extern "C" { HRESULT CreateRenderDevice(HINSTANCE hDll, AnauEngine **pInterface); typedef HRESULT (*CREATERENDERDEVICE) (HINSTANCE hDll, AnauEngine **pInterface); HRESULT ReleaseRenderDevice(AnauEngine **pInterface); typedef HRESULT (*RELEASERENDERDEVICE) (AnauEngine **pInterface); } //anaueld3d.h #define Max_Instances 8 class anaueld3d : public AnauEngine { public: anaueld3d(HINSTANCE a_Dll); ~anaueld3d(void); HRESULT Init(HWND); BOOL CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM); void Release(void); bool Ativo(void) {return a_Ativo;} HRESULT Render(bool, bool, bool); HRESULT Clear(bool, bool, bool); void StopRender(void); void SetClearColor(float, float, float); HRESULT UseWindow(UINT Hwnd); private: //AnauD3DEnum *a_Enum; LPDIRECT3D9 a_D3D; LPDIRECT3DDEVICE9 a_Device; LPDIRECT3DSWAPCHAIN9 a_Chain[Max_Instances]; D3DPRESENT_PARAMETERS a_d3dpp; D3DCOLOR a_ClearColor; bool a_Rendering; bool a_Stencil; HRESULT Go(void); void Log(char *, ...); }; I hope i didnt let things too much confused :) [Edited by - Corrosive on September 13, 2004 11:15:36 PM]