| | |
linking of .c and .h files
![]() |
•
•
Join Date: Jan 2009
Posts: 4
Reputation:
Solved Threads: 0
hi i m mohan sahu.i m using turbo c( borland compiler) and working with windows xp. i have one header file say myheader.h having only declarations of all functions and one myfunc.c file having only definitions of all function without main and i m including header file with #include "myheader.h" in this program.when i m using this header file in other program say func.c where i m including header by #include "myheader.h" but compiler is showing the error "unable to include myheader.h" .can anyone suggest me how to compile and link these files so that it will work properly.
•
•
Join Date: Jan 2009
Posts: 44
Reputation:
Solved Threads: 5
One possible reason can be that 'func.c' is not in the same directory/folder as 'myheader.h' and if this is the case then either you can put the 'myheader.h' in the same directory/folder as 'func.c'
OR
You can put the 'myheader.h' in some standard path where your turbo c compiler searches for standard .h files(but in this case you have to change the line from
to
Hope it helps....
OR
You can put the 'myheader.h' in some standard path where your turbo c compiler searches for standard .h files(but in this case you have to change the line from
C Syntax (Toggle Plain Text)
#include "myheader.h"
to
C Syntax (Toggle Plain Text)
#include <myheader.h>
Hope it helps....
•
•
Join Date: Nov 2008
Posts: 90
Reputation:
Solved Threads: 8
I have a small example how linking is to be done.
Suppose i have two program named imp.c and imp1.c
imp.c contains
imp1.c contains
then linking of above two programs with the program imp3.c
is done as
Suppose i have two program named imp.c and imp1.c
imp.c contains
C Syntax (Toggle Plain Text)
void arr() { printf("hello ajay"); }
C Syntax (Toggle Plain Text)
void art() { printf("My name is ajay"); }
is done as
C Syntax (Toggle Plain Text)
#include<stdio.h> #include<conio.h> #include<g:\tc\bin\imp.cpp> #include<g:\tc\bin\imp1.cpp> int main(void) { clrscr(); printf("this is the imp one:"); art(); arr(); return(0); }
•
•
Join Date: Nov 2008
Posts: 90
Reputation:
Solved Threads: 8
see read the the link:
http://www.daniweb.com/forums/thread170561.html
http://www.daniweb.com/forums/thread170561.html
![]() |
Similar Threads
- problem linking my files (C++)
- Problems Linking C++ Files (C++)
- Linking files for Compilation in C++ Data Structures (C++)
- problems wid cpp files (C++)
Other Threads in the C Forum
- Previous Thread: Please help me to run my own header file
- Next Thread: Preventing code from using code
| Thread Tools | Search this Thread |
adobe api array arrays binarysearch calculate char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators intmain() iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat opensource openwebfoundation owf pattern pdf performance pointer posix power probleminc program programming pyramidusingturboccodes read recursion recv recvblocked repetition research scanf scheduling segmentationfault send shape socketprograming socketprogramming stack standard strchr string suggestions systemcall test unix urboc user variable voidmain() wab win32api windows.h





