add file to MQX project issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

add file to MQX project issue

跳至解决方案
1,661 次查看
miniwang
Contributor III

Hi,

I created a empty MQX project, there are 2 files created - main.c and main.h.

I wrote a sample function(control GPIO) in main.c, it's OK for compile ,download and debug.

But when I try to move the function to another file(ex: IO.c, IO.h) to organize the code, there are thousand error occured.

(undefined identifier '_mqx_uint'  , identifier expected  , illegal function definition..........etc.)

Is there any setting should I do when I add other file to MQX project?

the environment : CodeWorrior 10.2  &  MQX 3.8.1

Thank you in advance.

Mini


标记 (3)
0 项奖励
回复
1 解答
1,252 次查看
Martin_
NXP Employee
NXP Employee

in your .c file you should include at least mqx.h and bsp.h:

#include <mqx.h>

#include <bsp.h>

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,253 次查看
Martin_
NXP Employee
NXP Employee

in your .c file you should include at least mqx.h and bsp.h:

#include <mqx.h>

#include <bsp.h>

0 项奖励
回复
1,252 次查看
miniwang
Contributor III

Martin, thanks for your reply.

it's already include those header file in my .c file.

Mini

0 项奖励
回复
1,252 次查看
Martin_
NXP Employee
NXP Employee

_mqx_unit typedef is in the header file psptypes.h.

psptypes.h is inclucded into your project via bsp.h, which includes psp.h, which includes psptypes.h

It seems the compiler can't find the psp header files in your project.

So you should double check all your compiler include paths - it seems the psp header files are not included. Compiler settings are specific to a project.

1,252 次查看
miniwang
Contributor III

Thanks a lot, Martin.

This issued have be solved.

The solution is add #include "main.h" in IO.c file. mqx.h and bsp.h are included in main.h.

I'm curious that I've already include mqx.h and bsp.h in IO.c, why I still need to include main.h?

Anyway, thanks for your help.