在尝试使用TouchGFX的时候会遇到很多坑。尤其是你使用TouchGX Designer并采用官方模板生成的工程。你需要添加很多头文件和源文件到工程中。- <touchgfx_application_root_directory>/gui/include
1 g' @7 l, \, P9 U3 I, D P; f - <touchgfx_application_root_directory>/generated/gui_generated/include" [) }7 `$ i/ r
- <touchgfx_application_root_directory>/platform/os/ v" s. U. ^- ?& U) ~6 y2 Z
- <touchgfx_application_root_directory>/generated/fonts/include- {3 ?; U, }$ _/ p* G* K7 S c
- <touchgfx_application_root_directory>/generated/images/include
, ~* v+ J' M8 y) t - <touchgfx_application_root_directory>/generated/texts/include2 G8 a7 e% o* u! S9 i! F
- <touchgfx_application_root_directory>/touchgfx/framework/include
复制代码 但是即便你尝试这样做之后,还会提示下面的错误:
, W& n* R: Q+ U `. G, u6 \Error: L6218E: Undefined symbol __aeabi_assert (referred from TouchGFXHAL.o)* Q+ k( y! I: t3 s* [1 n
在开头还会提示你MicroLib和C++同时使用的警告。3 R% i# j6 w% v' ] e" D8 b
在参考这篇文档(http://www.keil.com/support/docs/4073.htm)之后你可以看到解决方案。 R: G7 ? S, O' i. {
就是把MicroLib给勾掉。7 X; d: t" a8 F: N8 O: I' V( D
2 A5 S: H+ U$ B) |0 R2 B引申:
. C( n! P2 d. _5 ?# [那为什么会这样?
$ L# X; _" n- {1 H可以参考这篇文档的介绍:http://www.keil.com/support/man/docs/ARMLIB/armlib_chr1358938938431.htm# A2 K" j; ?/ y$ \% s( ]
基本上告知了MicroLib以下几个特点:
, [9 C8 q l4 I- 1、Microlib is not compliant with the ISO C library standard 不兼容标准ISO C库3 ]' ~/ W4 ]7 n$ n ?1 p/ ^) ~8 ?
- 2、Microlib is not compliant with the IEEE 754 standard for binary floating-point arithmetic 不兼容IEEE 754标准浮点运算
# g6 z$ y* I, U) _' a& p3 k - 3、Microlib is highly optimized for small code size高优化,小尺寸
: l3 |- s7 m# a - 4、Locales are not configurable 只有一个Locale,不可配置
: q x. f6 R; T+ o/ M% @ - 5、main() must not be declared to take arguments and must not return. Main函数不带参,不返回! N$ j1 E. x! }: t! N6 |' o
- 6、Microlib provides limited support for C99 functions。对C99支持不完善( P8 L0 f. ?& j7 z( J
- 7、Microlib does not support C++ 不支持C++
' h$ p; o& k; p; Y- R5 P+ O - 8、Microlib does not support operating system functions不支持操作系统函数
* \# l5 `+ S( b+ H2 Y5 l4 e - 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)$ X% q6 N) ~/ G! t6 F5 V1 D2 z
- 10、Microlib does not provide mutex locks to guard against code that is not thread safe不能通过mutex lock确保代码安全! x& T4 \' n" X# u" U/ W
- 11、Microlib does not support wide characters or multibyte strings不支持宽字符和多字节字符串
* o. {& K$ }3 D - ...太多了,不翻译了
复制代码 % `1 i' \6 G2 n0 H
其中第7条就告知了不支持c++。
9 f/ i; S+ x* Q* D2 A
% b+ c0 r/ f X3 C2 Y% G, Q: V x' B0 C% S E0 S
7 R/ I) o6 ?& |& b5 @" V3 G' o
' z- I) q2 }$ j' D) { |