473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

compiling header file

rampraveen
hai guys..just now before i download one header file for c.but i do't know how to use that,..tat header file is needed for another compiling of program....any body know pls tell.(in windows XP)
Apr 7 '10 #1

✓ answered by weaknessforcats

Header files contain declarations that may be needed in more than one implementation file (.c or .cpp). Rather than hard-code the declaration in every file, they are put in a header file.

Header files are just text files. By tradition, in C they have a .h extension and in C++ they have no extension. However, this is optional and not checked by the proprocessor.

Just:

#include <MyHeader.h>

or

#include "MyHeader.h"


The <> format says the header file is located along a predefined path. Known as "the usual places". You define these paths by going to your project's properties and looking at the ones for the preprocessor. One of thise properties is "additional include directories".

The " " format says the header file is located in the same folder as the implementation file. If it's not, then the usual places are searched sames is if you had used the <> format.

7 2701
weaknessforcats
9,208 Expert Mod 8TB
Header files contain declarations that may be needed in more than one implementation file (.c or .cpp). Rather than hard-code the declaration in every file, they are put in a header file.

Header files are just text files. By tradition, in C they have a .h extension and in C++ they have no extension. However, this is optional and not checked by the proprocessor.

Just:

#include <MyHeader.h>

or

#include "MyHeader.h"


The <> format says the header file is located along a predefined path. Known as "the usual places". You define these paths by going to your project's properties and looking at the ones for the preprocessor. One of thise properties is "additional include directories".

The " " format says the header file is located in the same folder as the implementation file. If it's not, then the usual places are searched sames is if you had used the <> format.
Apr 7 '10 #2
donbock
2,426 Expert 2GB
@rampraveen
Header files are not needed to execute a program; they are only needed to compile a program.
Apr 7 '10 #3
k.but to compile that header file is need.when i execute that program it wants that header fille.how can i use the new header file..pls tell
Apr 8 '10 #4
k.how can i use the new header file.......tat's my doubt..
Apr 8 '10 #5
weaknessforcats
9,208 Expert Mod 8TB
What is the "new header file"? Is is different from the on eyou started with?
Apr 8 '10 #6
donbock
2,426 Expert 2GB
@rampraveen
Please clarify ... do you get an error when you compile (build) your program or when you execute it? You keep saying the problem occurs when you execute your program, but that doesn't make any sense if we're talking about C preprocessor header files. Perhaps we're talking about something else.
Apr 8 '10 #7
jkmyoung
2,057 Expert 2GB
The header file you compiled basically tells the compiler -> "I'm going to be using these classes and functions. Don't worry about it now; I'll provide them later".

When you run the program, the program now says "Where is the compiled code for these classes and functions you told me about?"

You probably need to provide the compiled object code .o, for these headers that you used, when you are running your file.
Apr 8 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: tyousaf | last post by:
Hi i am new to mysql and mysql++, i have installed mysql server, it is running fine. i also installed "mysql++-1.7.9gcc3.2-2.i386.rpm" (i have gcc 3.3) , first of all as the readme file says to do...
7
by: Steven T. Hatton | last post by:
Is there anything that gives a good description of how source code is converted into a translation unit, then object code, and then linked. I'm particularly interested in understanding why putting...
18
by: Al | last post by:
I'm still trying to do this but it never worked! In a .cpp file, I write the code, and at the beginning, I write: #ifndef MYLIST_H #define MYLIST_H ....to end: #endif What's wrong with it for...
2
by: Barrie | last post by:
I'm having a quite complicate situation, and it doesn't want to compile. The situation is as follows: I have three classes, let's call them A, B and C. They each have a .h and a .cpp file. All...
13
by: ehabaziz2001 | last post by:
How can I compile that program under Solaris 8 using gcc and what header files will be used ? main() { /* Define default values: */ int n = 0; float x = 0.0;
8
by: WebSnozz | last post by:
I have an application written in C that does a lot of low level stuff. It does a lot of things like casting from void*'s. I want to create a new GUI for it in either C# or MC++, but reuse the...
2
by: stevenruiz | last post by:
Hi Everyone, The problem that I have involves compiling two files. I've received this error before and I understood that I was missing the correct library. The error is as follows: ld:...
5
by: jois.de.vivre | last post by:
I'm trying to include a C header file from an external library in my C+ + program but when I compile I get the following error: error: expected unqualified-id before 'private' error: abstract...
6
by: Gaijinco | last post by:
I'm having a weird error compiling a multiple file project: I have three files: tortuga.h where I have declared 5 global variables and prototypes for some functions. tortuga.cpp where I...
13
by: Albert | last post by:
Hi I'm using the lcc compiler for win32. I tried compiling a program but there's an error stating: "cpp: Can't open input file clrscr()" I don't get it - I've included <tcconio.h>. (strange why...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.