Include Issues (Linux and Netbeans)

closed account (1yvU5Di1)
Okay..
I have 4 files.
A.cpp
b.h
self.h
self.cpp

A.cpp contains main and includes only self.h
b.h contains functions wrapped in namespaces
self.h has class prototype
self.cpp defines members of class prototype in self.h by including self.h first
self.cpp also includes b.h in order to use the declared namespaces.

This works perfectly when compiled as a Dev C++ project but never works in Linux and in Netbeans on any platform.

What is the way out?
Last edited on
What is it that doesn't work? Do you get an error message?
closed account (1yvU5Di1)
When I compile in netbeans, all functions are declared twice irrespective of my #ifndef speculations.
If I compile in terminal, class doesn't exist. In fact, hell rains on this one.
closed account (1yvU5Di1)
Nobody knows
Post your code. Do you expect us to be psychic?
closed account (1yvU5Di1)
This issue requires no code. It's about proper include procedure, not code-dependent stuff.
Don't bring up the negative comments.
When I compile in netbeans, all functions are declared twice irrespective of my #ifndef speculations.

Make sure you do not define non-inline functions in the header files.

If I compile in terminal, class doesn't exist. In fact, hell rains on this one.

Make sure you compile and link all your source (.cpp) files.

Also make sure you use unique include guard macros for each header.
Last edited on
closed account (1yvU5Di1)
Make sure you do not define non-inline functions in the header files.


So where should I put them?
I have written long namespaces and I must include them to compile the project.
Put function declarations in header files, and function definitions in source files.
Last edited on
Topic archived. No new replies allowed.