PDA

View Full Version : C2871 Error : namespace doesnot exist



snow_starzz
12th May 2015, 10:52
Hi guys,

I have some problem with external lib.. i try to include external lib into my project but it producing this C2871 error.

C:\Qt\OpenCVProject\20150505_23_Vid\mainwindow.h:9 : error: C2871: 'Videoman' : a namespace with this name does not exist
I already include the related .h file but its still showing the error.. What should i do? Where did i do wrong?

this is my .pro file

QT += core gui opengl xml

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = uEyeCam
TEMPLATE = app


SOURCES += main.cpp\
mainwindow.cpp

HEADERS += mainwindow.h

FORMS += mainwindow.ui

win32:CONFIG(release, debug|release): LIBS += -LC:/OpenCV/VideoMan1.1/build/lib/ -lVideoMan
else:win32:CONFIG(debug, debug|release): LIBS += -LC:/OpenCV/VideoMan1.1/build/lib/ -lVideoMand

INCLUDEPATH += C:/OpenCV/VideoMan1.1/include
DEPENDPATH += C:/OpenCV/VideoMan1.1/include

my .h file


#include <QMainWindow>
#include "VideoManControl.h"
#include "VideoManInputFormat.h"

using namespace std;
using namespace Videoman;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();

private slots:
void on_displayButton_clicked();
void openCamera();

private:
Ui::MainWindow *ui;
};

and VideoManControl.h file

#ifndef VIDEOMANCONTROL_H
#define VIDEOMANCONTROL_H

#ifdef WIN32
#ifdef VideoMan_EXPORTS
#define VIDEOMAN_API __declspec(dllexport)
#else
#define VIDEOMAN_API __declspec(dllimport)
#endif
#endif
#ifdef linux
#define VIDEOMAN_API
#endif

#include "VideoManInputFormat.h"

namespace VideoManPrivate
{
class VideoManControlPrivate;
class VideoManInputController;
};

namespace VideoMan
{
///////---------related code-------------///////
};
#endif

thanks in advance..

anda_skoa
12th May 2015, 17:07
Typo in namespace name.
VideoMan vs Videoman

Cheers,
_

snow_starzz
13th May 2015, 09:24
Typo in namespace name.
VideoMan vs Videoman

Cheers,
_

OMG!!! thank you so much...

spending days trying to include the library..
after get rid of include error, error cant used the namespace appeared...
mybe i over think this... this is embarrassing..

d_stranz
13th May 2015, 18:23
mybe i over think this... this is embarrassing..

There isn't a single one of us here that hasn't been there and done this.

stampede
13th May 2015, 21:26
spending days trying to include the library..
:) Try using a nice code editor with code completion feature - this way you can just type "using namespace Vid" and press ctrl+space :cool: