Mikkel christensen wrote:
[color=blue]
> I wonder if any of you could point me in a direction where I can find some
> usefull information about coding standarts.[/color]
I have yet to see one single coding standard document that I agree with
(now) - even ones I wrote myself.
Project requirements change, tools change (and get better).
For example, at one point, my coding standard was to not use namespaces.
(because at the time the compilers and debuggers did not support them
well, this is no longer the case).
Exceptions are still in my grey area. Having used them in a recent
project, I found them both useful and generally more difficult to debug
in some cases.
The things that remain in my (unwritten) coding standard are benign
things like indentation etc. The rest are based on requrements of the
project.
Much of it is driven by a "Test Driven Design" (aka TDD) process where
the final design deliverables are interfaces and unit tests and peer
review is done on the unit tests themselves.
[color=blue]
>
> 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".[/color]
The most portable thing is to use guards, e.g.
----- file.h -----
#ifndef x__file_h__x
#define x__file_h__x 1
.... stuff goes here ...
#endif // x__file_h__x
------------------
If you look at austria C++ you'll see what I mean.
http://austria.sourceforge.net/dox/h...8h-source.html
[color=blue]
>
> 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.[/color]
Are you targetting more than MS ? If so you might want to look at a
cross platform build system.
[color=blue]
>
> 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).[/color]
I'm not understanding what you want to say.
[color=blue]
> 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:)[/color]
Take a look at how Austria C++ is organized - It uses MakeXS as it's
build tool which can be made to generate VC++ project files as well as
build on platforms that use GNU make. It works with cygwin under Win32.