- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
multiple-attachments.zip
(Virus scan in progress ...)
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
baremetal_function_op.jpg
(Virus scan in progress ...)

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page