Connecting Tech Pros Worldwide Help | Site Map

how to create a header file in c++

  #1  
Old October 22nd, 2006, 11:20 AM
Newbie
 
Join Date: Oct 2006
Posts: 20
Hi all,

Can u tell me steps by step as how to create header file with my own defined functions and where to place it in TC folder. I tried to save it in INCLUDE but failed terribly.
  #2  
Old October 22nd, 2006, 01:19 PM
arne's Avatar
Expert
 
Join Date: Oct 2006
Posts: 307

re: how to create a header file in c++


Quote:
Originally Posted by Shana
Hi all,

Can u tell me steps by step as how to create header file with my own defined functions and where to place it in TC folder. I tried to save it in INCLUDE but failed terribly.
Did you try to put it in the same directory as your source code file?
(What is TC, btw? Turbo-C?)
  #3  
Old October 23rd, 2006, 06:02 AM
Newbie
 
Join Date: Oct 2006
Posts: 20

re: how to create a header file in c++


Yes TC for Turbo C, I have created header file called "header.h" and saved in include, and then I have created function program and had saved in LIB. After that I wrote a main program which use that function and header file and saved it in bin. Now the prob is when I compile it, I do not get any error however executing the program gives linker error that it does not recognise the function.
  #4  
Old October 23rd, 2006, 08:17 AM
arne's Avatar
Expert
 
Join Date: Oct 2006
Posts: 307

re: how to create a header file in c++


Quote:
Originally Posted by Shana
Yes TC for Turbo C, I have created header file called "header.h" and saved in include, and then I have created function program and had saved in LIB. After that I wrote a main program which use that function and header file and saved it in bin. Now the prob is when I compile it, I do not get any error however executing the program gives linker error that it does not recognise the function.
I am not at all familiar with Turbo C I have to admit, but:
- there should either be the concept of a "project" to which you add your header files; the IDE will then take care of compiling and linking all the stuff; or
- you have to define an include path to tell the IDE where it can find the headers

These are the typical approaches I would say.

Did you try to store your headers in the same dir as you cpp files? This would be a starting point.
  #5  
Old October 23rd, 2006, 10:49 AM
Newbie
 
Join Date: Oct 2006
Posts: 20

re: how to create a header file in c++


yes i did try it, as far as i know the project thing is in Visual C++. Right now i cannot be online but I will come back tommorow with the enitre code as it is small program just to make sure that a header file can be created and linked with Turbo C++ libraries.
  #6  
Old February 14th, 2007, 06:08 AM
Newbie
 
Join Date: Feb 2007
Posts: 1

re: how to create a header file in c++


hi! any one of u can teach me how i can make my own header file using turbo c++??????
  #7  
Old February 14th, 2007, 07:49 AM
Member
 
Join Date: Feb 2007
Posts: 52

re: how to create a header file in c++


I think ARNE is correct. You should set the path to the "include" directory.
But here's a catch : If your IDE is supporting other programs, i.e. no linker errors are coming in other programs, then I think you should study the user manuals of TurboC++ get thinks right.
Pawan
  #8  
Old July 2nd, 2008, 05:46 PM
Newbie
 
Join Date: Jul 2008
Posts: 2

re: how to create a header file in c++


actually i want to step by procese how to make header file in tourbo c please sende me the procese
  #9  
Old July 2nd, 2008, 06:05 PM
Newbie
 
Join Date: Jul 2008
Posts: 2

re: how to create a header file in c++


Quote:
Originally Posted by arne
Did you try to put it in the same directory as your source code file?
(What is TC, btw? Turbo-C?)
yes i want to step by step procese how to create my own library header file in torbo c editer
  #10  
Old July 2nd, 2008, 07:16 PM
Familiar Sight
 
Join Date: Mar 2008
Posts: 174

re: how to create a header file in c++


In you main.cpp file or whatever you named it at the top did you put:
Expand|Select|Wrap|Line Numbers
  1. #include<header.h>
because if you didn't it wont work.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create header files in c/c++ bhandarisourabh answers 10 October 6th, 2008 12:49 PM
Building userdefined header file in ASP.Net suryagayathri answers 1 March 23rd, 2007 07:30 AM
How to create header file with compiling Al answers 18 November 22nd, 2005 04:16 AM
Difference between a library file and a header file in C s.subbarayan answers 4 November 14th, 2005 07:18 AM