NO

Author Topic: Header files not supported???  (Read 5365 times)

Jakykong

  • Guest
Header files not supported???
« on: December 05, 2004, 03:24:59 PM »
I have a problem. You see i am learning how to program in the WIN32 environment. This is going fine, but there are 2 serious problems i am having. I'll list the biggest one here: when in the IDE, and trying to include a .h file (in this case, main.h), it gives me an error "Unable to add 'main.h' to the project. The target file cannot be determined from the source files extension"
This is a completely idiotic message as far as i can tell. Since .h files are almost impossible to go without in C, especially with large programs, there should be no problem including this file. I recieved the same error when i created a new .h file (again main.h... saved over it) and it asked me if i wanted to add it to the project.
Now, the second strange thing about this complete and utter lack of support for header files in my installation of Pelles C, is that when opening a file, there is no "header files (*.h)" option in the file type selection, i must choose "all files (*.*)" and select the file from there.
Third, and final odd thing. After i add the include file directory containing my header files (yup... it actually had that list of directories. Surprizing with these other problems), and include my include file (containing standard call functions for such functions as FindEqualint(int[], equal) that finds an equal integer within an array, and CustomRNG(seed) which i use for a custom random number generator (i like to call them RNGs - look at the function name). After i include the file (And that works fine), i try to compile the program, and it gives me an error regarding the use of the functions contained within main.h

Any ideas why i might be having these problems?

JohnF

  • Guest
Re: Header files not supported???
« Reply #1 on: December 05, 2004, 04:55:03 PM »
Quote from: "Jakykong"
I have a problem. You see i am learning how to program in the WIN32 environment. This is going fine, but there are 2 serious problems i am having. I'll list the biggest one here: when in the IDE, and trying to include a .h file (in this case, main.h), it gives me an error "Unable to add 'main.h' to the project. The target file cannot be determined from the source files extension"
This is a completely idiotic message as far as i can tell. Since .h files are almost impossible to go without in C, especially with large programs, there should be no problem including this file. I recieved the same error when i created a new .h file (again main.h... saved over it) and it asked me if i wanted to add it to the project.


Header files are included with an include statement in any C file.  e.g.

#include <windows.h>   // in the PellesC include folder
#include "myheader.h" // in the projects folder

Take a look at others examples.

Quote

Now, the second strange thing about this complete and utter lack of support for header files in my installation of Pelles C, is that when opening a file, there is no "header files (*.h)"


Can't say, it is definitely shown here. *h, *c, *rc, *ppj, etc.

John

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Header files not supported???
« Reply #2 on: December 05, 2004, 06:27:15 PM »
When you add source files (*.c) to a project, they will be scanned automatically by the IDE, and any referenced include files (*.h) will be added automatically - you should never, ever, add include files manually to a project.

Pelle
/Pelle

Jakykong

  • Guest
Header files not supported???
« Reply #3 on: December 10, 2004, 09:35:04 PM »
To john: thanks,

to Pelle: no, it didn't add referenced include files to the project when i added a source file. I can try again, maybe by removing and re-adding the file it will, but that was unsucessful.

I tried to add it manually, to no avail. The kin process referred above may be a solution, but i need to try it again.


Cheers, thanks for all the help!

Jakykong

  • Guest
problem solved!
« Reply #4 on: December 10, 2004, 09:56:24 PM »
Hey!
i found my problem!

thanks to john who pointed out
#include <stdio.h>
is not the same as
#include "stdio.h"

as it was the same in some other compilers i've used... that solved everything!!!

thanks guys!!