Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,317 Views

Include files not found in Altera-SoCFPGA-HelloWorld-Baremetal-GNU

Hello, 

 

I got the example project Altera-SoCFPGA-HelloWorld-Baremetal-GNU to work. I am using DS-5 and the target is Cyclone 5 SoC. 

I modified the hello.c so that it calls a function from another c file.  

For some reason on building the project, it says the custom header file (test_func.h) is not found (even when it is right there!). (See attached images) 

I initially had placed the header file in the root folder (among the c files) but seeing that it didn't work, moved it to the folder 'proj_files' which still doesn't help. 

This seems like a very simple problem but I can't seem to get around it.  

Am I supposed to move the include file (test_func.h) someplace else? Any suggestions? 

 

Thanks!
0 Kudos
2 Replies
Altera_Forum
Honored Contributor I
38 Views

Hi, 

 

The solution is very simple, you have to change the way how you include your own headers. 

 

#include <stdio.h> 

This method is used to include standard library header files. The preprocessor searches the file normally in normally in directories pre-designated by the compiler. 

 

#include "proj_files/testfunc.h" 

This method is used to include programmer defined header files. The preprocessor searches the file in the same directory as the include directive. 

 

 

Just try it out.
Altera_Forum
Honored Contributor I
38 Views

Hi, 

I tried your suggestion and it seemed to help partially. So thank you for that. 

It recognized the header file but it still couldn't reference the function correctly. It kept saying "undefined reference to function fastgps()" 

 

I then noticed in the Makefile, see line# 6 in the attached screenshot, the second C file (testfunc.c) was not listed and I had to manually write that down to successfully build it.  

 

I wonder why it doesn't list all the C files on its own.
Reply