| | |
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 |
#include * ansi array arrays asterisks bash binarysearch calculate centimeter changingto char character convert copyanyfile copyimagefile cprogramme creafecopyofanytypeoffileinc createprocess() database dynamic execv fgets file floatingpointvalidation fork function getlogicaldrivestrin givemetehcodez grade gtkwinlinux hacking histogram ide inches include infiniteloop input interest intmain() iso kernel keyboard kilometer km license linked linkedlist linux list looping lowest matrix meter microsoft number oddnumber open opendocumentformat openwebfoundation owf pdf pointer posix power probleminc process program programming pyramidusingturboccodes radix read recursion recv recvblocked research reversing scheduling segmentationfault send sequential single socket socketprogramming standard strchr string suggestions systemcall test threads turboc unix urboc user variable wab whythiscodecausesegmentationfault win32api windowsapi





