Sign in to follow this  

One last linker error,, halp

This topic is 3104 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

RAAAWR I've been banging on my desk for half an hour trying to figure this one out. I'm trying to compile this simple DirectX program in VS08, but the compiler is complaining that the MainLoop function inside loop.cpp has no idea what the HandleMessage function is (which is defined inside main.cpp and declared in global.h). loop.cpp:
#include "global.h"

// only the HandleMessages function is listed here for brevity

bool HandleMessages();

// main loop
void MainLoop(){

   while(HandleMessages()){
   
       // Input();
       // Logic();
       // Render();
   }
}

main.cpp:
#include "global.h"

bool HandleMessage(){

   static MSG msg;
   
   if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
   
      if(msg.message == WM_QUIT) return FALSE;
      
      TranslateMessage(&msg);
      DispatchMessage(&msg);
   }
   
   return TRUE;
}
global.h:
// header files
#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <iostream>
#include "gamewindow.h"

// libraries
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")

// prototypes for
// WinMain.cpp
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void DisplayWindow(GAMEWINDOW* gw, HINSTANCE hInstance, int nCmdShow);
bool HandleMessages();

// Loop.cpp
void MainLoop();

// Direct3D.cpp
void InitDirect3D(GAMEWINDOW* gw);
void CloseDirect3D();
What is the problem here?

Share this post


Link to post
Share on other sites

This topic is 3104 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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