Question about header files

I am very new to C++. I have programmed a little in C. I thought I was familiar with header files. I had always viewed them just as code that gets copied and pasted to the beginning of your main code that usually consisted of declarations of functions or variables, and I feel like you should just be able to include them into any program with no problems.

I have a big c++ project that I can compile and run to set the Product ID & Vendor ID of a micro-controller that is used as a USB bridge to a FPGA circuit. Ultimately, I need to be able to write my own program to interface on a low level with this chip and do stuff (blink lights, set baud rate, whatever). They have given me a API so I think I should just be able to a few subroutine calls and it shouldn't be too difficult.

I wrote up a simple hello world program to get familiar with C++ and it works fine until I try to include a header file in an attempt to maybe use this API I ahve been given. Then my program breaks and says,

"1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afx.h(24) : fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
1>StdAfx.cpp"

I tried to do a 'control F' on the AFXDLL and I can't find anything and don't know what it is talking about.

I have a feeling I am missing some basic important concept. Can anyone point me in the right direction of what I can start checking? Anything is always appreciated.

Thanks
You are not missing an important basic concept, but you are trying to build a project that is using a common runtime component. Try creating a new, empty, win32 c++ project.
I figured out the problem. I am in visual studio and I had to go to the configuration properties of the project and select "Use MFC in a Shared DLL". I figured this out by checking all the properties of my new project to the one of the example project that already worked.
Thanks.
Topic archived. No new replies allowed.