Nested namespace can't be found in spite of including header file

784 views Asked by At

I have two projects, one is a sample (which compiles without error) and looks like this (first few lines shown only):

Working Example

#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/Surface.h"
#include "cinder/gl/gl.h"
#include "cinder/gl/Texture.h"
#include "cinder/Rand.h"
#include "cinder/qtime/QuickTimeGl.h"

using namespace ci;
using namespace ci::app;
using namespace std;

class QTimeAdvApp : public App {
  public:
    void prepareSettings( Settings *settings );
    void setup();

    void keyDown( KeyEvent event );
    void fileDrop( FileDropEvent event );

    void update();
    void draw();

    void addActiveMovie( qtime::MovieGlRef movie );
    void loadMovieUrl( const std::string &urlString );
    void loadMovieFile( const fs::path &path );

};

Note especially the line: void addActiveMovie( qtime::MovieGlRef movie );

The other project, which needs to make use of the same library (Quicktime OpenGL within LibCinder), tries to do something similar - one again an extract:

Use in Project

#pragma once

#include "AbstractContent.h"
#include "cinder/gl/Texture.h"
#include "cinder/Tween.h"
#include "AbstractTransition.h"
#include "cinder/qtime/QuickTimeGl.h"

namespace TH {

    class VideoContent : public AbstractContent {
    public:
        VideoContent();
        ~VideoContent();
        virtual void setup();
        void loadMovie(ci::Url url);
        void loadLocalMovie(ci::fs::path path);
        void setPreloadedMovie(ci::qtime::MovieGlRef movie);

This one throws a compiler error: No member named 'qtime' in namespace 'cinder'

Notice again the virtually identical line: void setPreloadedMovie(ci::qtime::MovieGlRef movie); In fact, you can use the full qualified name ci:qtime:MovieGlRef in the first example and it compiles just fine (as expected).

What on earth is going on here? Why does the "Use in Project" version throw a compiler error: No member named 'qtime' in namespace 'cinder'?

Just for clarity, the QuickTimeGl.h file in turn includes another file which definitely declares the namespace and the type def:

namespace cinder { namespace qtime {

typedef std::shared_ptr<class MovieGl>  MovieGlRef;

Am I missing something? I'm pretty sure I'm including the correct header file, as before, and even trying to use the fully qualified namespace but still the compiler doesn't find the definition?

1

There are 1 answers

0
Morpheu5 On

Have you tried referencing the global namespace, with ::ci::qtime rather than simply ci::qtime? This should not make a difference, but sometimes C++ compilers trip over these kind of things.