在尝试使用TouchGFX的时候会遇到很多坑。尤其是你使用TouchGX Designer并采用官方模板生成的工程。你需要添加很多头文件和源文件到工程中。- <touchgfx_application_root_directory>/gui/include7 k% M0 e& O* H0 N |. p; N% h2 Y
- <touchgfx_application_root_directory>/generated/gui_generated/include
0 L: j3 F% R4 R: } - <touchgfx_application_root_directory>/platform/os
$ ~) e7 W) ~& ?" y& V - <touchgfx_application_root_directory>/generated/fonts/include
- @) O% L4 e# ~) F% ^3 y k! d& ^ - <touchgfx_application_root_directory>/generated/images/include
& [/ B; u4 n* \9 L - <touchgfx_application_root_directory>/generated/texts/include
) e8 M6 R+ X5 h1 r. P; f - <touchgfx_application_root_directory>/touchgfx/framework/include
复制代码 但是即便你尝试这样做之后,还会提示下面的错误:
8 V% B. p! g3 [( C5 dError: L6218E: Undefined symbol __aeabi_assert (referred from TouchGFXHAL.o)6 F4 M) Y0 V" R
在开头还会提示你MicroLib和C++同时使用的警告。
% h- ?# C$ D# H: D0 P- \% z6 W4 p, g7 }在参考这篇文档(http://www.keil.com/support/docs/4073.htm)之后你可以看到解决方案。3 S) g* B7 e4 v2 o [0 L9 G
就是把MicroLib给勾掉。2 l9 B% k J$ F$ l: F: ~
4 T# i: t# P6 y! {: D
引申:
2 A8 ~- a! H! c* \那为什么会这样?3 j- z6 L- C" U' E1 ?9 Q) z) t
可以参考这篇文档的介绍:http://www.keil.com/support/man/docs/ARMLIB/armlib_chr1358938938431.htm
) K t* A# ]; J+ v/ \基本上告知了MicroLib以下几个特点:
6 j& m! X2 F3 V2 |+ k7 @- 1、Microlib is not compliant with the ISO C library standard 不兼容标准ISO C库, O* J6 n B, n: e$ g3 J
- 2、Microlib is not compliant with the IEEE 754 standard for binary floating-point arithmetic 不兼容IEEE 754标准浮点运算9 M. U/ L6 J3 o+ ]! }: s+ e
- 3、Microlib is highly optimized for small code size高优化,小尺寸+ j: k, A1 x! z* E+ T2 F
- 4、Locales are not configurable 只有一个Locale,不可配置
+ y& H) }6 `7 D% S - 5、main() must not be declared to take arguments and must not return. Main函数不带参,不返回
! ^: U* k( Z7 u: f ] A - 6、Microlib provides limited support for C99 functions。对C99支持不完善
/ Q3 t/ q* k! f/ Z0 T y6 H' G - 7、Microlib does not support C++ 不支持C++% W' ?* w/ _" [* I3 K2 R! l8 O
- 8、Microlib does not support operating system functions不支持操作系统函数
6 |5 K! b0 x/ {$ ~6 I - 9、Microlib does not support position-independent code 不支持地址无关代码(http://zh.wikipedia.org/wiki/%E5%9C%B0%E5%9D%80%E6%97%A0%E5%85%B3%E4%BB%A3%E7%A0%81)7 Z( f }. U- u2 v& F2 v
- 10、Microlib does not provide mutex locks to guard against code that is not thread safe不能通过mutex lock确保代码安全
^' g5 X- p' T8 q! F( K; ^) I/ ^ - 11、Microlib does not support wide characters or multibyte strings不支持宽字符和多字节字符串
, w- i" K2 D3 B - ...太多了,不翻译了
复制代码 3 Q* _- Q; R5 |! E9 R$ S7 B* M: ^) [
其中第7条就告知了不支持c++。
& q9 w5 f6 k( L3 z( O4 O$ V; Z5 r- c% Z: N% Z! y
6 P0 {& `' Z- ^' V
' N3 D/ U) O9 \9 U3 i
4 k K I5 K H' Q& | |