Is there a function to check if a function or variable is declared?
Printable View
Is there a function to check if a function or variable is declared?
not really... what's your situation?
Quote:
Originally Posted by major_small
i have a strange feeling it's a circular include
Quote:
Originally Posted by misplaced
what is a circular include, ive never heard of it before?
oversimplified:
file1:file2:Code:#include "file1"
Code:#include "file2"
> Is there a function to check if a function or variable is declared?
Yeah, it's called a compiler.
If it isn't declared, it prints a message.
you took the easy answer :DQuote:
Originally Posted by Salem
What you gave is two examples of self-inclusion. I assume what you meant was;Quote:
Originally Posted by major_small
file1:file2:Code:#include "file2"
Code:#include "file1"
I'll take a wild guess at his situation.
To make sure its not included more than once when compiling, add this at beginning of .h file: #ifndef FILENAMEHERE_H_, and #define FILENAMEHERE_H_, and then #endif at the end of the .h file.
yeah, that's what I meant... sorry about any confusion I caused :(Quote:
Originally Posted by grumpy
It might be a double-include.
file1:file2:Code:#include "file3"
file4:Code:#include "file3"
Code:#include "file1"
#include "file2"
To answer your question. C++ requires a build environment of some sort in order to build an application. This is included in part of the Critique of C++ (http://ortdotlove.net/docs/ACritiqueOfC++.pdf). This is why we have things like autotools who's job is to determine if functions exist and if they confrom to a particular implementation. I'd suggest starting by learning Scons. It is an easy to use and learn build environment. And then if you care you can learn autotools which is quite painful and most likely going to give you braindamage. Both work under *NIX and Win32 (win32 requires something like cygwin).