M
Mike Copeland
For years, I've been placing all my projects and all my various
include files in a single directory (CPP). It's now quite large (and
messy!), and I'm trying to convert my code to a newer compiler. This
new system seems to expect each project's source to exist in a separate
directory structure, but I want all projects share my include files.
I can't figure how to structure my sources so that I can use a single
#include "stdafx.h" statement in my project's main source file. A
project's source stdafx.h file contains the following:
////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <sstream>
#include <ostream>
#include <string>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <io.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <direct.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <conio.h>
#include "myclass3.h"
#include "mylib2.h"
#include "myua2.h"
#include "myprint2.h"
using namespace std;
///////////////////////////////////////////
This works, but I'm trying to place my own include files
("myclass.h", etc.) in a different directory (/incl, for example) that
can be referenced by many projects. I've tried various things, such as:
#include "../incl/stdafx.h"
in my main code, but that doesn't work at all (the compiler can't find
the stdafx.h file).
My structure (which doesn't work) is:
/CPP
/CPP/hello01 (a project directory)
/CPP/incl (directory for all include files)
/CPP/project02 {another project's directory)
[etc.]
I'm unable to find any examples (by googling) that demonstrate how to
use a single "stdafx.h" file in sources other than the directory in
which the source files reside (or how to set up a common "include"
directory). It seems fundamental to multiple project development, but I
just can't figure it out. Please advise. TIA
include files in a single directory (CPP). It's now quite large (and
messy!), and I'm trying to convert my code to a newer compiler. This
new system seems to expect each project's source to exist in a separate
directory structure, but I want all projects share my include files.
I can't figure how to structure my sources so that I can use a single
#include "stdafx.h" statement in my project's main source file. A
project's source stdafx.h file contains the following:
////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <sstream>
#include <ostream>
#include <string>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <io.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <direct.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <conio.h>
#include "myclass3.h"
#include "mylib2.h"
#include "myua2.h"
#include "myprint2.h"
using namespace std;
///////////////////////////////////////////
This works, but I'm trying to place my own include files
("myclass.h", etc.) in a different directory (/incl, for example) that
can be referenced by many projects. I've tried various things, such as:
#include "../incl/stdafx.h"
in my main code, but that doesn't work at all (the compiler can't find
the stdafx.h file).
My structure (which doesn't work) is:
/CPP
/CPP/hello01 (a project directory)
/CPP/incl (directory for all include files)
/CPP/project02 {another project's directory)
[etc.]
I'm unable to find any examples (by googling) that demonstrate how to
use a single "stdafx.h" file in sources other than the directory in
which the source files reside (or how to set up a common "include"
directory). It seems fundamental to multiple project development, but I
just can't figure it out. Please advise. TIA