Why doesnt this work?

Started by
1 comment, last by perfectly_dark 22 years, 2 months ago
I read the font Tutorial for beginners and I tried the code and it didnt work because of these two lines: HFONT fnt; fnt = CreateFont(14,0,0,0,0,0,0,0,0,0,0,0,0, "Arial"); Heres the errors I get: C:\Program Files\Microsoft Visual Studio\MyProjects\DirectX\DirectX.cpp(20) : error C2501: ''fnt'' : missing storage-class or type specifiers C:\Program Files\Microsoft Visual Studio\MyProjects\DirectX\DirectX.cpp(20) : error C2040: ''fnt'' : ''int'' differs in levels of indirection from ''struct HFONT__ *'' C:\Program Files\Microsoft Visual Studio\MyProjects\DirectX\DirectX.cpp(20) : error C2440: ''initializing'' : cannot convert from ''struct HFONT__ *'' to ''int'' This conversion requires a reinterpret_cast, a C-style cast or function-style cast Error executing cl.exe. The origial code was HFONT fnt Fnt = CreateFont(...) but fnt and Fnt are not the same, Case-Sensitive, any help?
Advertisement
It almost sounds like you don''t have the right headers included, I think windows.h is all you need for fonts.
here''s my headers:
#include <windows.h>
#include <windowsx.h>
#include <iostream.h>
#include <math.h>
#include <malloc.h>
#include <ddraw.h>

I dont think it''s the headers, when I remove the second line it compiles error free.

This topic is closed to new replies.

Advertisement