Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12435 Discussions

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

Honored Contributor II



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? 


0 Kudos
2 Replies
Honored Contributor II



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.
Honored Contributor II


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.