how to include some dll functions in a project

John (Eljay) Love-Jensen
Mon Nov 24 22:37:00 GMT 2008

Hi bigbig,

> I finally solve the problem by moving all the #include directives from bidon.h
to bidon.c.

I have a list of shoulds & oughts for header files.

Header files should not emit bytes (neither code, nor data) when compiled.

If at all possible, header files should be idempotent and self-contained.
They should include any header files they depend upon, and vice versa,
should not include header files they do not depend upon.  (There are
exceptions to this rule, but the better this ruled is followed, the better
off your project will be.)

For C++ headers, they may include things such as...
+ comments
+ conditional compilation directives
+ constant definitions
+ data declarations
+ enumerations
+ function declarations (function prototypes)
+ include directives (but only those things that header itself depends upon)
+ inline function definitions
+ macro definitions (but I plead to use constraint)
+ name declarations (forward references)
+ named namespaces (but NOT anonymous namespaces)
+ template declarations
+ template definitions
+ type definitions

A header should never contain things-that-emit-bytes...
x aggregate definitions
x data definitions
x exported template definitions
x ordinary function definitions
x unnamed namespaces

I expect the problem you ran into was having one of those things that
shouldn¹t be in a header file, in one of your header files.


More information about the Gcc-help mailing list