CnPack Forum


 
Subject: 请教一个TAAFont的问题?(宏定义相关)问题已解决!
lygily
新警察
Rank: 1



UID 39557
Digest Posts 1
Credits 20
Posts 4
点点分 20
Reading Access 10
Registered 2008-4-7
Status Offline
Post at 2008-4-7 16:12  Profile | Blog | P.M. 
请教一个TAAFont的问题?(宏定义相关)问题已解决!

TAAFont * AAFont = new TAAFont(tBitmap->Canvas);
AAFont->TextOutA(50, 250,"TEST", 50, 0);

C++ Builder报如下错:

[Linker Error] Unresolved external '__fastcall Aafont::TAAFont::TextOutA(int, int, System::AnsiString, signed char, signed char)' referenced from D:\BCB_PROJECT\20080407\UNIT1.OBJ

请问是什么回事?多谢了!

附我用的是2.63版本的AAFont
BCB版本为6.0

[ 本帖最后由 lygily 于 2008-4-9 10:51 编辑 ]
Top
zjy
管理员
Rank: 9Rank: 9Rank: 9



UID 2
Digest Posts 6
Credits 2385
Posts 1543
点点分 2385
Reading Access 102
Registered 2002-12-16
Location China
Status Offline
Post at 2008-4-8 08:16  Profile | Site | Blog | P.M. 
TAAFont 没有 TextOutA 方法,应该用 TextOut。




Zhou JingYu
CnPack Administrator
http://www.cnpack.org/
Top
lygily
新警察
Rank: 1



UID 39557
Digest Posts 1
Credits 20
Posts 4
点点分 20
Reading Access 10
Registered 2008-4-7
Status Offline
Post at 2008-4-8 09:01  Profile | Blog | P.M. 
续:TAAFont

用TextOut也是一样的,报的错也是报 TextOutA无定义,所以如果写上TextOut,结果也一样报如下错:

[Linker Error] Unresolved external '__fastcall Aafont::TAAFont::TextOutA(int, int, System::AnsiString, signed char, signed char)' referenced from D:\BCB_PROJECT\20080407\UNIT1.OBJ

因为编译器会自动判断该用TextOutA还是TextOutW,一般头文件中会有如下定义:

#ifdef UNICODE
#define TextOut  TextOutW
#else
#define TextOut  TextOutA
#endif // !UNICODE

那如果没有定义TextOutA,而编译器又主张去调用,是否是产生这个问题的原因?

[ 本帖最后由 lygily 于 2008-4-8 09:09 编辑 ]
Top
zjy
管理员
Rank: 9Rank: 9Rank: 9



UID 2
Digest Posts 6
Credits 2385
Posts 1543
点点分 2385
Reading Access 102
Registered 2002-12-16
Location China
Status Offline
Post at 2008-4-8 15:55  Profile | Site | Blog | P.M. 
OH,原来是宏的问题

你可以试试在调用 TextOut 之前 #undef TextOut,看能不能解决?




Zhou JingYu
CnPack Administrator
http://www.cnpack.org/
Top
lygily
新警察
Rank: 1



UID 39557
Digest Posts 1
Credits 20
Posts 4
点点分 20
Reading Access 10
Registered 2008-4-7
Status Offline
Post at 2008-4-8 17:09  Profile | Blog | P.M. 
回复 #4 zjy 的帖子

加了没有效果,还是报相同的问题。

不过还是要感谢zjy的关注!

[ 本帖最后由 lygily 于 2008-4-8 17:12 编辑 ]
Top
zjy
管理员
Rank: 9Rank: 9Rank: 9



UID 2
Digest Posts 6
Credits 2385
Posts 1543
点点分 2385
Reading Access 102
Registered 2002-12-16
Location China
Status Offline
Post at 2008-4-9 10:21  Profile | Site | Blog | P.M. 
把 #undef TextOut 放在 #include <vcl.h> 和 #include "AAFont.hpp" 中间,在BCB6下编译通过:

#include <vcl.h>
#pragma hdrstop

#undef TextOut
#include "Unit1.h"
#include "AAFont.hpp"




Zhou JingYu
CnPack Administrator
http://www.cnpack.org/
Top
lygily
新警察
Rank: 1



UID 39557
Digest Posts 1
Credits 20
Posts 4
点点分 20
Reading Access 10
Registered 2008-4-7
Status Offline
Post at 2008-4-9 10:50  Profile | Blog | P.M. 
回复 #6 zjy 的帖子

可以了,多谢了!
Top
 




All times are GMT++8, the time now is 2024-10-31 08:53

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.006047 second(s), 7 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP