We help IT Professionals succeed at work.
Get Started

gnu c++ header files for libraries.

sean-keys
sean-keys asked
on
700 Views
Last Modified: 2012-08-11
Hi I created a qt based library which works fine.  My issue is that I'm trying to figure out how to cleanly expose my header file without creating an inclusion mess.

For example the app that calls my library needs only one header file.  My problem is that header file has other inclusions that don’t relate to the functions it provides.

SerialIO.h

#ifndef SERIALIO_H_
#define SERIALIO_H_

#include <stdio.h> //for printf
#include <fcntl.h>
#include <string.h> // for memset
#include <string>
#include <inc/AsyncRead.h>
#include <inc/AsyncWrite.h>
#include <inc/types.h>
//#include <inc/CircularBuffer.h>
#include <QObject>
#include <QString>
#include <QWaitCondition>

Open in new window


The lines:
#include <inc/AsyncRead.h>
#include <inc/AsyncWrite.h>

are only needed to compile the lib itself not link against it.

What is the standard/proper way to accomplish this?
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2012
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE