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!
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.
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.