查看: 3655|回复: 2

[已解决] GCC工程链接出错undefined reference to gmtime(已解决)

[复制链接]

该用户从未签到

1

主题

9

帖子

0

新手上路

Rank: 1

积分
5
最后登录
1970-1-1
发表于 2014-4-21 17:52:32 | 显示全部楼层 |阅读模式
 我将我的一个工程的源代码移植到另一个project里边,工具链是GCC,所有问题目前基本都解决了,除了一个,或者说一类问题:
undefined reference to ‘gmtime’
我已经正确的#include ,在源程序中Ctrl+鼠标左键也能打开gmtime的定义,但是编译工程会报如上的错误。创建工程使用的是默认方式创建,ProcessExpert模式,其余都导入进来了,编译也都通过。
另外,诸如mktime, gmtime_s之类的也不行,折腾了好长时间了……
 重新编译了ewl库,什么都没修改,本地编译,一大堆警告也看不懂……


BTW:为啥想起来换GCC了,用FSL编译器,不知道为什么,机器一上电运行到main函数第一句(未执行),全局变量初始化就不对(怀疑是汇编引导文件出错了),然后各种离奇的错误,函数间互相影响,最后程序跑飞。
void voidfunStorageCAll(GeneralFrameBufStruct *gFramePtr);
void (*funStorageCALL)(GeneralFrameBufStruct *)=&voidfunStorageCAll;
为什么funStorageCALL的值,在debug调试时,用expression查看,为voidfunStorageCAll程序首地址+1,ARM函数不是应该是对齐地址么?(弱弱问一句,thumb2是对齐到4还是2?)
 
我知道答案 目前已有1人回答
回复

使用道具 举报

该用户从未签到

2

主题

113

帖子

0

中级会员

Rank: 3Rank: 3

积分
326
最后登录
1970-1-1
发表于 2014-4-22 11:30:52 | 显示全部楼层

RE:GCC工程链接出错undefined reference to gmtime

刚才看到一个同事给的关于time.h的答案:
Unfortunately the time functions are not implemented  - This header file (time.h) is provided for compatibility only, the implementation is fully hardware dependent.
"The ANSI library provides several functions to get the current time. In an embedded systems environment, implementations for these functions cannot be provided because different targets may use different ways to count the time."
If you need it, you have to write your own functions (if you have some Real Time Clock component on your board)
回复 支持 反对

使用道具 举报

该用户从未签到

2

主题

113

帖子

0

中级会员

Rank: 3Rank: 3

积分
326
最后登录
1970-1-1
发表于 2014-4-22 11:33:39 | 显示全部楼层

RE:GCC工程链接出错undefined reference to gmtime

关于对齐,可以参考下面的帖子:
http://forum.eepw.com.cn/thread/194944/1
和:
http://www.amobbs.com/thread-4225005-1-1.html
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条

Archiver|手机版|小黑屋|恩智浦技术社区

GMT+8, 2025-7-19 08:54 , Processed in 0.089647 second(s), 23 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表