From: Luke D. <cod...@ho...> - 2003-05-15 14:09:30
|
>From: "Peter Mcleod" <pe...@an...> >To: min...@li... >Subject: [Mingw-users] List of font names (EnumFontFamiliesEx) >Date: Thu, 15 May 2003 13:03:55 +0200 > >Can anybody help me with a method for obtaining a list of >font names (true type) using the windows api? > >I've tried the method EnumFontFamiliesEx but am getting an >undefined reference during the link phase in regards to the >callback function. Details of this are not with me at the >moment but I thought I'd post just to see if anybody has an >extract of code for doing this using mingw (or if there's >perhaps a standard library)? > You should be defining the callback function yourself, so naturally you shouldn't get an undefined reference unless you did something like declare it and define it differently (assuming C++), or with a different name. If you post your code I expect that it will become clear. Luke _________________________________________________________________ ninemsn Extra Storage is now available. Get larger attachments - send/receive up to 2MB attachments (up to 100 percent more per e-mail). Go to http://join.msn.com/?page=dept/home&pgmarket=en-au |
From: Peter M. <pe...@an...> - 2003-05-15 22:48:29
|
Here's my code followed by the link error: // Sample Test piece of code: #include <windows.h> #include <stdio.h> #include <conio.h> int CALLBACK EnumFontFamiliesExProc( ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, int FontType , LPARAM lParam ) { printf( "%s\n", lpelfe->elfFullName ); return 1; } int main( int __argc, char** __argv ) { HDC hDC = GetDC( NULL ); LOGFONT lf = { 0, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, "Courier New" }; EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)EnumFontFamiliesExProc, 0, 0 ); ReleaseDC( NULL, hDC ); return 0; } and this is the link error sh-2.04$ make gcc -o font.exe font.o font.o(.text+0xe0):font.c: undefined reference to `EnumFontFamiliesExA@20' make: *** [font.exe] Error 1 sh-2.04$ On Thu, 15 May 2003 22:09:24 +0800 "Luke Dunstan" <cod...@ho...> wrote: > > >From: "Peter Mcleod" <pe...@an...> > >To: min...@li... > >Subject: [Mingw-users] List of font names > (EnumFontFamiliesEx) > >Date: Thu, 15 May 2003 13:03:55 +0200 > > > >Can anybody help me with a method for obtaining a list > of > >font names (true type) using the windows api? > > > >I've tried the method EnumFontFamiliesEx but am getting > an > >undefined reference during the link phase in regards to > the > >callback function. Details of this are not with me at > the > >moment but I thought I'd post just to see if anybody has > an > >extract of code for doing this using mingw (or if > there's > >perhaps a standard library)? > > > > You should be defining the callback function yourself, so > naturally you shouldn't get an undefined reference unless > you did something like declare it and define it > differently (assuming C++), or with a different name. If > you post your code I expect that it will become clear. > > Luke > > _________________________________________________________________ > ninemsn Extra Storage is now available. Get larger > attachments - send/receive up to 2MB attachments (up to > 100 percent more per e-mail). Go to > http://join.msn.com/?page=dept/home&pgmarket=en-au > == Download ringtones, logos and picture messages at Ananzi Mobile Fun. http://www.ananzi.co.za/cgi-bin/goto.pl?mobile |
From: Robert W. <rwi...@sh...> - 2003-05-16 01:20:57
|
----- Original Message ----- From: "Peter Mcleod" <pe...@an...> To: "Luke Dunstan" <cod...@ho...>; <min...@li...> Sent: Thursday, May 15, 2003 3:47 PM Subject: [Mingw-users] Re: List of font names (EnumFontFamiliesEx) > Here's my code followed by the link error: > > // Sample Test piece of code: > #include <windows.h> > #include <stdio.h> > #include <conio.h> > > int CALLBACK EnumFontFamiliesExProc( ENUMLOGFONTEX *lpelfe, > NEWTEXTMETRICEX *lpntme, int FontType > , LPARAM lParam ) > > { > printf( "%s\n", lpelfe->elfFullName ); > return 1; > } > int main( int __argc, char** __argv ) > > { > HDC hDC = GetDC( NULL ); > > LOGFONT lf = { 0, 0, 0, 0, 0, 0, 0, 0, > DEFAULT_CHARSET, 0, 0, 0, 0, "Courier New" }; > EnumFontFamiliesEx(hDC, &lf, > (FONTENUMPROC)EnumFontFamiliesExProc, 0, 0 ); > ReleaseDC( NULL, hDC ); > return 0; > } > > and this is the link error > > sh-2.04$ make > gcc -o font.exe font.o > font.o(.text+0xe0):font.c: undefined reference to > `EnumFontFamiliesExA@20' > make: *** [font.exe] Error 1 > sh-2.04$ The EnumFontFamiliesEx prototype is in wingdi.h and it requires linking with Gdi32.lib. Robert Wishlaw > > On Thu, 15 May 2003 22:09:24 +0800 > "Luke Dunstan" <cod...@ho...> wrote: > > > > >From: "Peter Mcleod" <pe...@an...> > > >To: min...@li... > > >Subject: [Mingw-users] List of font names > > (EnumFontFamiliesEx) > > >Date: Thu, 15 May 2003 13:03:55 +0200 > > > > > >Can anybody help me with a method for obtaining a list > > of > > >font names (true type) using the windows api? > > > > > >I've tried the method EnumFontFamiliesEx but am getting > > an > > >undefined reference during the link phase in regards to > > the > > >callback function. Details of this are not with me at > > the > > >moment but I thought I'd post just to see if anybody has > > an > > >extract of code for doing this using mingw (or if > > there's > > >perhaps a standard library)? > > > > > > > You should be defining the callback function yourself, so > > naturally you shouldn't get an undefined reference unless > > you did something like declare it and define it > > differently (assuming C++), or with a different name. If > > you post your code I expect that it will become clear. > > > > Luke |
From: Peter M. <pe...@an...> - 2003-05-16 06:04:58
|
Thanks a-lot Robert - it's working now. Robert wrote: >The EnumFontFamiliesEx prototype is in wingdi.h and it >requires linking with Gdi32.lib. >Robert Wishlaw == Download ringtones, logos and picture messages at Ananzi Mobile Fun. http://www.ananzi.co.za/cgi-bin/goto.pl?mobile |
From: Roger K. W. <ROG...@sa...> - 2003-05-16 11:59:58
|
Peter Mcleod wrote: >Here's my code followed by the link error: > >// Sample Test piece of code: >#include <windows.h> >#include <stdio.h> >#include <conio.h> > >int CALLBACK EnumFontFamiliesExProc( ENUMLOGFONTEX *lpelfe, >NEWTEXTMETRICEX *lpntme, int FontType >, LPARAM lParam ) > >{ > printf( "%s\n", lpelfe->elfFullName ); > return 1; >} >int main( int __argc, char** __argv ) > >{ > HDC hDC = GetDC( NULL ); > > LOGFONT lf = { 0, 0, 0, 0, 0, 0, 0, 0, >DEFAULT_CHARSET, 0, 0, 0, 0, "Courier New" }; > EnumFontFamiliesEx(hDC, &lf, >(FONTENUMPROC)EnumFontFamiliesExProc, 0, 0 ); > ReleaseDC( NULL, hDC ); > return 0; >} > >and this is the link error > >sh-2.04$ make >gcc -o font.exe font.o >font.o(.text+0xe0):font.c: undefined reference to >`EnumFontFamiliesExA@20' >make: *** [font.exe] Error 1 >sh-2.04$ > > >On Thu, 15 May 2003 22:09:24 +0800 > "Luke Dunstan" <cod...@ho...> wrote: > > >>>From: "Peter Mcleod" <pe...@an...> >>>To: min...@li... >>>Subject: [Mingw-users] List of font names >>> >>> >>(EnumFontFamiliesEx) >> >> >>>Date: Thu, 15 May 2003 13:03:55 +0200 >>> >>>Can anybody help me with a method for obtaining a list >>> >>> >>of >> >> >>>font names (true type) using the windows api? >>> >>>I've tried the method EnumFontFamiliesEx but am getting >>> >>> >>an >> >> >>>undefined reference during the link phase in regards to >>> >>> >>the >> >> >>>callback function. Details of this are not with me at >>> >>> >>the >> >> >>>moment but I thought I'd post just to see if anybody has >>> >>> >>an >> >> >>>extract of code for doing this using mingw (or if >>> >>> >>there's >> >> >>>perhaps a standard library)? >>> >>> >>> >>You should be defining the callback function yourself, so >>naturally you shouldn't get an undefined reference unless >>you did something like declare it and define it >>differently (assuming C++), or with a different name. If >>you post your code I expect that it will become clear. >> >>Luke >> >> >> >> >_________________________________________________________________ > > >>ninemsn Extra Storage is now available. Get larger >>attachments - send/receive up to 2MB attachments (up to >>100 percent more per e-mail). Go to >> http://join.msn.com/?page=dept/home&pgmarket=en-au >> >> >> > > >== >Download ringtones, logos and picture messages at Ananzi Mobile Fun. >http://www.ananzi.co.za/cgi-bin/goto.pl?mobile > > >------------------------------------------------------- >Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara >The only event dedicated to issues related to Linux enterprise solutions >www.enterpriselinuxforum.com > >_______________________________________________ >MinGW-users mailing list >Min...@li... > >You may change your MinGW Account Options or unsubscribe at: >https://lists.sourceforge.net/lists/listinfo/mingw-users > > > > use: gcc fonts.c -lgdi32 works fine on W2K, gcc version 3.2.3 (mingw special 20030425-1) -- Roger Wells, P.E. SAIC 221 Third St Newport, RI 02840 401-847-4210 (voice) 401-849-1585 (fax) ro...@mt... |