Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

building a c program

Status
Not open for further replies.

seamusmcd

New Member
how can i build my c program which includes a few of my own header files without going back and compiling all of my header files seperately...... thanks
 
The include keyword lets you do what you want

#include "my_header.h"

The quotes mean that the header is in the same directory as the .c file.

#incude <header.h> means that the file is in a central library folder.
 
These are my header files:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "rand.h"
#include "alloc.h"
#include "blockio.h"
#include "open.h"
#include "mod2sparse.h"
#include "mod2dense.h"
#include "mod2convert.h"
#include "rcode.h"
#include "enc.h"

everytime i restart the main program i have to recompile each header file individually. is there anyway i can compile my main file without having to go back and compiling all the header files.
 
This sounds like an issue with your development environment. You shoudn't have to compile the .h files. They should get compiled as though they were inserted into file they are included in.

If you give a bit more info it would help.
 
If there's actual code in those file, make them into libraries, or simply put them in a different source file and reference them, leave only defines inside the header files.
 
Status
Not open for further replies.

Latest threads

Back
Top