Just to comment on a few of your problems...
<You wrote..
I have one specific project containing ~15 header files and as many saource
files which gives me trouble when the compiler starts linking.
"unresolved externals" showing all the time. Compiling each file on it's
own
does not show any errors.
And the reasons you can compile each file by itself, is that you do not
link...
The linker is the one complaining about "Unresolved externals" or
"unresolved symbols"...
My guess is, there is some kind og namespace conflict... One difference
between compilers I could think of is,
wether or not they what all members defined, even if they are not used in
the application. I think VC7.net wants
them defined, do not know about gcc though... (and I do not know if the
standard has anything on this)
With namespaces, be sure to structure your files so all #includes are
outside namespaces...
header file: "SomeCollectionOfSomeSort.h"
#pragma once
#include "MySpecial.h"
namespace Flanhart {
class SomeCollectionOfSomeSort {
public:
SomeCollectionOfSomeSort();
};
}//end namespace Flanhart
implementation file:"SomeCollectionOfSomeSort.cpp"
//include here - first the file you are implementing
#include "SomeCollectionOfSomeSort.h"
//include dependencies here
namespace Flanhart {
//implement here
SomeCollectionOfSomeSort::SomeCollectionOfSomeSort () {
//DoStuff
}
}//end namespace Flanhart
So do not try to #include anything while you are in a namespace, since the
header file itself states it is in a namespace.. If you cannot figure it
out, try removing all namespaces, and check if you can build, if you cannot,
then it is not a namespaces, but probably access to libraries or access to
your own unimplemented functions/methods/(statics)...
Hope this will help you
Jesper Madsen
"Mikkel christensen" <04***@eit.iha.dk> wrote in message
news:cm**********@news.cybercity.dk...
Hi there
I wonder if any of you could point me in a direction where I can find some
usefull information about coding standarts.
I have some generel experiense in programming but I lack many things
specific to C++.
One thing that causes me many troubles is how to properly nest "#include
'filename'" statements in combination with the "#pragma once" directive
and "using namespace".
I have one specific project containing ~15 header files and as many
saource files which gives me trouble when the compiler starts linking.
"unresolved externals" showing all the time. Compiling each file on it's
own does not show any errors.
Each file has it's own class, and pointers to some of the classes are
given to them so they can use each other (one file combines it all and creates
objects and pointers to them).
I know these problems occour because my understanding of how to structure
bigger (well for me this is "bigger" than I'm used to) projects are
insufficient.
I have not been able to find any usefull information regarding this topic
though I've been searching google all day.
This project are made in VC++ 7 but as far as I'm concerned the compiler
should not matter at all as long as I'm using the right coding standarts.
I might add that the project would previously compile just fine using GCC
but then terminate upon execution when one class member tries to access
public data in another class through it's pointer.
This shows me I need some general knowledge about projects with multiple
files that include each other.
I hope some of you can point me in direction towards the shining bright
light:)
- Mikkel