I've been testing things with multiple project setups where a console application accesses functions from several DLLs.
I thought about how to include the DLLs' headers in the console application. My current implementation is as follows but it's being a headache to manage and even sometimes runs into errors:
- Each DLL project has a folder called "Include"
- The Console application project references the Include folder of each DLL project (as suggested by msdn guide to working with DLLs)
- Each DLL project contains a single header that includes all the headers in that one project
- The console application then #includes these "master headers"
- Every project uses the pre-compiled header "stdafx" and each file #includes it.
It worked out fine until I started overloading operators. I believe the grief is caused by the pre-compiled header somehow, here's and example of my current usage of stdafx:
#define DLL // Found in every DLL, not in the console project
#ifdef DLL
#define DLLEI __declspec(dllexport)
#else
#define DLLEI __declspec(dllimport)
#endif
#include <iostream>
#include <vector>
#include "Include\Engine.h"
using namespace std;
With this I sometimes get some irrelevant random compiler errors that I can hackfix by excluding the header from the "master header" and including the troublemaker separately in the console app.
Suggestions what could be done better?