Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

compiler cannot find header files

I imported a folder containing one header file and several c files into the Nios II project. When I included the header file in my main task c file located outside the folder, the compiler point out the error: xx.h:No such file or directory.

Is anybody able to help me out?

Thanks a lot!

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    1. Path names cannot have spaces.

    2. You need to include the path in the includes section of the compiler options.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you for your reply. But there are still some problem in my project. I am now using Nios II EDS 9.1. I am trying to include the paths of my folders into the project, but I am not sure my operation is right. After opening 'properities', I click 'Nios II Application Paths' and add the paths of my folders to the section of 'Application include directories'. Then I build the project, and it show some errors. Like, undefined reference to 'main'. I had specified a main function in the folder but the compiler cannot detect it. What can I do to deal with the problem?

    Thanks a lot!
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    It sounds like you're probably creating your Include paths correctly. 'Undefined reference to main' sounds more like a linker error than a compiler error. Make sure your main.c (or whatever file your main is in) compiles correctly. If it doesn't, you won't have a main.o file and the linker will fail.