mfc project - problems with header files

I have a MFC project I'm developing to use for a Labjack data-acquisition card. I had it to compile at one time but when I added some files to include I keep getting errors. I'm not sure whether to put the include statements in the cpp or the header files. There's too much code to list here so I have the zip file on my website:

labjack application
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi zliminator,

could you first simply post the part of the ouput where the first errors occur?

The link to the ZIP file seems to be dead ...

zliminatorAuthor Commented:
I don't know if I copied the link wrong but it should work. Here it is without the link:

Here it is with the link:

ok, there are several problems in the code.

First, the main problem is the file "labjackocx.h" includes "data.h" which itself again includes "labjackocx.h". The way you designed the classes (CData uses a CLabJackOCX and CLabJackOCX uses a CData) isn't possible this way. You can only solve this by using a forward declaration for one of these classes, i.e.: instead of including "data.h" in "labjackocx.h" simply add this forward declaration befor the definition of CLabJackOCX:

    class CData;

Further problems are:

Some header files are included more than once producing 'class type redifintion' errors. You should add a '#pragma once' as first lines in these headers:

In some files the class CLabjackApp3Dlg is undefinded, so you need to add '#include "LabjackApp3Dlg.h"' in these files:

In 'data-h' you include 'stdafx.h' which is either useless (since it's already included everywhere you include 'data.h') and not recommended (since 'stdafx.h' has a very special role regarding precompiled headers) - you should remove this.

In 'config.h' you include 'afxwin.h'. This is useless since it is already included via 'stdafx.h', you should remove this.

I hope I didn't miss anything.

Hope that helps,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.