Hi everyone,
Im working on a large scale audio program, and I got a question regarding namespaces:
The main() part of the program includes my own headers, each named according to what part it plays in the program, eg: Audio.hpp , Midi.hpp etc. These headers will "load" other headers..? Is this illegal? or can the following be done/fixed?
Inside these headers, i will have a "global" namespace. Best way to describe this is:
audio.hpp
namespace Audio
{
// Audio Include
#include <iostream>
int jack_create_client()
{
std::cout << "In jack_create_client() " << std::endl;
}
}
Code in Engine.cpp
namespace Engine
{
#include "audio.hpp"
}
Now say i have a main.cpp, and in it is this:
//#include <iostream> // Uncomment, and it compiles.
#include "engine.hpp"
int main(int argc, char** argv)
{
Engine::Audio::jack_create_client();
return 0;
}
However uncommenting that line exposes iostream to the main.cpp file. (in this case its not bad, but if im using some audio processing function, it could name-clash with a similar function for midi.)
Any Idea how i can call jack_create_client()
in a similar way to Engine::Audio::jack_create_client()
without this problem??
Hope i made the question clear, i realize its a little complex to explain!
-Harry