Error C2065: "undeclared identifier"

Started by
4 comments, last by Habba 18 years, 8 months ago
this line of code gives me the error: AddFontResourceEx("FLATBN__.TTF",FR_PRIVATE,0); And here's the description of the error: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/c2065.asp As I undestand it the problem is that my compiler (Visual C++ 6) can't find declarition for that function. It's declared in wingdi.h, which is included in windows.h. I included windows.h and added gdi32.lib to my linking list. It's not working. Got any ideas?
Advertisement
Have a look at this: Using the Windows Headers. This should help you solving the problem, since this function is only defined starting with Windows 2000, according to the Platform SDK documentation.

Edit: Don't have the VC 6 headers by hand, but you may need the latest headers that are included in the Platform SDK. You serach in WinGDI.h for AddFontResourceEx and you should see if it is defined at all (guarded by #if (_WIN32_WINNT >= 0x0500)).
Where is FR_PRIVATE declared?
Are they declared in some namespace?
Quote:Original post by Sparhawk42
Where is FR_PRIVATE declared?
Are they declared in some namespace?


FR_PRIVATE is also declared in wingdi.h, right next to the function. Both of them gives me the error.
Have you tried to define _WIN32_WINNT to be 0x0500 either in stdafx.h (if you use precompiled headers), before including the very first header or in the compiler settings tab?
Quote:Original post by VolkerG
Have you tried to define _WIN32_WINNT to be 0x0500?


I tried that couple of times and finally it worked. This was the source of problems. Thank you both very much for your troubles.

Although I've programmed new for several years, I'm still quite a beginner with C++. It's so... complicated, compared to Visual Basic, Java, PERL, &#106avascript...

This topic is closed to new replies.

Advertisement