C file can't find local header file to include

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

C file can't find local header file to include

9,189 次查看
carlh
Contributor I

Hi,

 

First post and first time working with Code Warrior, but not with Eclipse...hence my question.

 

In Eclipse you can create sub-folders containing C code files and local header files, and Eclipse can build all the source in any sub-folder.

 

But In CW the same is not true. I created a sub-folder containing a C file which includes a local header file found in the same folder. The compiler does find and tries to compile the C file, but fails because it can't find the local header file to include....which is not standard C compiling behaviour.

 

I know that all the compiling is carried out in a different location from the source location for the project, but is there any setting to make it go back and look in the original C file folder for the local header? I'm hoping I don't have to add all the paths for all the source folders to the project.

 

thanks in advance

/carl h.


标签 (1)
0 项奖励
回复
6 回复数

3,918 次查看
JeffSumey
Contributor I

Hi Carl-

I ran into this same issue.

Yes, CodeWarrior has a setting to allow the compiler to look for the local header file in the same folder as the C file.

Go to Project -> Properties -> C/C++ Build -> Settings -> Compiler -> Input.

There you will find a box for "User Path".

Add your C file folder path there and you should be good to go.

--JeffS

0 项奖励
回复

3,918 次查看
carlh
Contributor I

Hi Jeff,

I was aware of this already…..which I was trying to avoid. You don’t have to do this in raw Eclipse. Eclipse knows about the path to any sub-folder without having to specify it here.

I know it’s an easy fix to add the paths but we have up to 10 sub-folders in our project managed by several people. I was hoping to make the sub-folders isolated from each other from a build point of view.

Why would CW change this Eclipse behavior I wonder.

/carl h.

From: Carl Heyendal

Sent: Wednesday, April 17, 2013 9:31 AM

To: 'jive-1546135996-4j7m-2-6yms@freescale-phx.hosted.jivesoftware.com'

Subject: RE: CodeWarrior for MCU - C file can't find local header file to include

Thanks Jeff. I’ll give it a try.

/carl h.

0 项奖励
回复

3,918 次查看
jsumey
Contributor I

Subfolders, ahh...

On that same settings panel, there is also a "User Recursive Path (-ir)" setting.

Perhaps this will do what you want.

--JeffS

0 项奖励
回复

3,918 次查看
carlh
Contributor I

Hi Jeff,

It was staring right at me!!

Yes your ‘-ir’ suggestion works, though I wonder why you have to do this in CW and not in Eclipse.

It is a better solution than including paths to every sub-folder.

Thanks for your help.

/carl h.

0 项奖励
回复

3,918 次查看
jsumey
Contributor I

Don't know that answer, but I'm glad this solution solved your issue!

/jeff

0 项奖励
回复

3,918 次查看
carlh
Contributor I

Thanks Jeff. I’ll give it a try.

/carl h.

0 项奖励
回复