Hi guys,

I'm facing a problem I am having some trouble understanding. It's a linker error.

I'll paste my code here and then explain what the problem is.

DREAMD3DDeviceCaps.h
Code:
#ifndef _DREAMD3DDEVICECAPS_H
#define _DREAMD3DDEVICECAPS_H

#pragma once

#define STRICT
#define WIN32_LEAN_AND_MEAN

#include <d3d9.h>
#include <DXUT.h>
#include <DXUTenum.h>

class DREAMD3DDeviceCaps
{
private:
	//D3DCAPS9	*m_pDeviceCaps;
	CD3D9Enumeration *m_pD3D9Enumeration;

public:
	DREAMD3DDeviceCaps( void );
	~DREAMD3DDeviceCaps( void );

	CD3D9Enumeration* GetDeviceCaps( void );

	// Static methods in charge of updating the capabilities list based on
	// the current options enabled for the adapter
	// Used by the configuration dialog
	//============================================================================
	static void ChangedAdapter( void );
	static void ChangedDevice( void );
	static void ChangedAdapterFmt( void );
	static void ChangedWindowMode( void );
	//============================================================================
};

#endif
DREAMD3DDeviceCaps.cpp
Code:
#include "DREAMD3DDeviceCaps.h"

DREAMD3DDeviceCaps::DREAMD3DDeviceCaps()
{
	m_pD3D9Enumeration = DXUTGetD3D9Enumeration( false );
}

DREAMD3DDeviceCaps::~DREAMD3DDeviceCaps()
{
}

CD3D9Enumeration* DREAMD3DDeviceCaps::GetDeviceCaps( void )
{
	return m_pD3D9Enumeration;
}

void DREAMD3DDeviceCaps::ChangedAdapter( void )
{
}

void DREAMD3DDeviceCaps::ChangedDevice( void )
{
}

void DREAMD3DDeviceCaps::ChangedAdapterFmt( void )
{
}

void DREAMD3DDeviceCaps::ChangedWindowMode( void )
{
}
The problem is that I get a linker eror as follows:
Code:
1>DREAMD3DDeviceCaps.obj : error LNK2019: unresolved external symbol "class CD3D9Enumeration *
 __stdcall DXUTGetD3D9Enumeration(bool)" (?DXUTGetD3D9Enumeration@@YGPAVCD3D9Enumeration@@_N@Z) 
referenced in function "public: __thiscall DREAMD3DDeviceCaps::DREAMD3DDeviceCaps(void)" (??0DREAMD3DDeviceCaps@@QAE@XZ)
So I figured that I wasn't linking to a library that I needed and so the DXUTGetD3D9Enumeration function was unresolved. But after searching on the net, there didn't seem to be a library missing. So out of desperation, I removed the constructor from the CPP file and rewrote the header file constructor as follows:
Code:
	DREAMD3DDeviceCaps( void ){m_pD3D9Enumeration = DXUTGetD3D9Enumeration( false );}
And mysteriously, this links without a problem. It must be a really stupid mistake but I just can't see it so I turn to you guys in hopes that someone knows why this happens. As a last resort, I can just write the function in the header file but it's kind of dirty and I'm really curious to know what's causing the problem. Why does it link if I do it in the header file and doesn't link if I do it in the cpp file.

Thanks