I am using Visual C++ Express Edition.
I have 3 files: (A) main.cpp, (B) prototypes.h (C) implementation.cpp.
main.cpp includes prototypes.h and prototypes.h includes implementation.cpp. When I go to "Start without debugging" things screw up because in (C) implementation.cpp the compiler complains that it can't find the data fields. e.g. it's not properly connecting with the .h file. How do I fix this?

Step 1: Create a console project. File --> New --> Project. Project types: select Win32. Templates: select "Win32 Console Application". Near the bottom of the screen enter a project name and location. Then press Ok button.

Step 2: On this window just click Next

Step 3: Application Settings window: Uncheck the Precompiled Headers setting. That is very useful for complex programs with lots of files, but not for simple programs. Click Finish button.

Step 4: You will see a starter _tmain() function. I would just delete that code. You will also want to change the project settings so that the compiler does not attempt to compile for UNICODE. To do that, select Project --> <project> Properties (at the bottom of the menu), expand the Configuration Properties menu, select General. On the right side of the screen change "Character Set" to "Not Set".

Step 5: copy the two *.cpp and *.h files into the project folder so that they can be used in the project. This step would have been unnecessary had you created the project when you first started.

Now you are ready to add your files to the project.
In Solution Explorer (left side of the screen) right-click the folder named "Source Files". A drop-down men appears, and you want to select the very first one that says "Add". That will give you another popup menu, and select the second menu item that says "Existing Item". This will give you a dialog box where you can select the main.cpp and implementation.cpp. You can select them both or just one at a time. After you highlighted (selected) the file(s) press the Add button at the bottom of the dialog box.

Now you have to edit prototypes.h to remove the #include "implementation.cpp" line. You never ever want to include *.cpp files in header files. Its always the other way around. Now edit implementation.cpp and add #inlcude "impleentation.h" near the top of the file.

Now you are ready to compile the program. Since both *.cpp files are now part of the project the compiler will compile each *.cpp file individually and link them together to create a single executable program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.