Question:
C programming in a unix environment......?
David G
2010-10-11 08:51:23 UTC
Hello

A friend of mine is learning C and she's doing so using a unix environment. I've taken some classes in C in the past and it was the norm to start any program with a library header, such as #include but none of her C programs using unix had any library header. Why is this?
Three answers:
maybach_hp
2010-10-11 09:35:39 UTC
You cannot execute a program without a header files or path to the header files. '#' mean search the current working directory and if not found the parent directory. So check the program it will have an absolute path of the header file something like C:\Programs\stdio.h.



If it still does not exist then it's the editor been used. You can set the relative path as part of the setting of the editor. However in commercial c programming, header files are mentioned in just one file and in all programs this file is mentioned as header file.



Hope this makes sense.



Good luck!

ยง
Nik
2010-10-11 09:17:47 UTC
Off the top of my head, two reasons I can think of:



- She's not referencing any symbols defined in external libraries/headers

- Her environment, or the script/command she uses to compile her code, is configured to automatically include a certain set of headers and link with the appropriate libraries



I suppose it's also possible her compiler isn't a standard C compiler, and is doing something clever.
Chris C
2010-10-11 09:21:41 UTC
Is it possible that the include files were generically included in one file. And that file was part of the make file or compilation script?



Without knowing the definition of the functions, C doesn't allow compilation to complete successfully.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...