Little problem with compiling Qt4 app (Ambigious symbol)
-
@1>.\GeneratedFiles\Debug\moc_cirrationalengine.cpp(20) : error C2872: 'uint' : ambiguous symbol
1> could be 'c:\qt\4.7.0\include\qtcore../../src/corelib/global/qglobal.h(899) : unsigned int uint'
1> or 'g:\users\eggman\downloads\ogresdk_vc9_v1-7-1\include\ogre\OgrePrerequisites.h(108) : Ogre::uint'@As you can see from that, there's a problem when i compile the app with this, here is my header file that i believe causes this error:
@
#ifndef MATERIAL_EDITOR_H
#define MATERIAL_EDITOR_H#include <QtGui/QMainWindow>
#include "ui_Material_Editor.h"
#include "CRenderer.h"
using namespace Ogre;class MaterialEditor : public QMainWindow
{
//Q_OBJECT
public:
MaterialEditor(QWidget* parent = 0,
Qt::WindowFlags f = 0)
: QMainWindow(parent,f)
{
MatEdit.setupUi(this);
}~MaterialEditor()
{}
bool createMaterialPreviewWindow()
{
m_pMatWindowRoot = Root::getSingletonPtr();NameValuePairList pList;
String MatWinHdle;
MatWinHdle += StringConverter::toString((Ogre::uint)(this->MatEdit.Material_Preview->winId()));
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
pList["externalWindowHandle"] = MatWinHdle;
#endifthis->m_pMatRenderWindow = m_pMatWindowRoot->createRenderWindow("Material_Preview",
MatEdit.Material_Preview->width(),
MatEdit.Material_Preview->height(),
false,
&pList);this->m_pMatRenderWindow->setActive(true);
return true;
}private:
Ui::Material_Editor MatEdit;
Root* m_pMatWindowRoot;
SceneManager* m_pMatSceneMgr;
RenderWindow* m_pMatRenderWindow;
};#endif
@
seems to be ok.......then again i'm no expert on a lot of things about C++ :-p
So how to get rid of that? seems like i might have to do something or what not. Hmmm -
You can remove
@
using namespace Ogre
@It should help.
-
@static const uint qt_meta_data_CIrrationalEngine[] = {
// content:
5, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount// slots: signature, parameters, type, tag, flags
19, 18, 18, 18, 0x08,0 // eod
};
@the problem comes frm this file, i removed the using namespace Ogre......so idk, let me know if u need something else, the material editor is important although not so important that i can stop dev of the engine.
-
so removing using didn't help? can you provide current output of compiler and text of file where this error happens (or at least all includes and usings from this file and some code around error string)?
-
@>moc_cirrationalengine.cpp
1>.\GeneratedFiles\Debug\moc_cirrationalengine.cpp(20) : error C2872: 'uint' : ambiguous symbol
1> could be 'c:\qt\4.7.0\include\qtcore../../src/corelib/global/qglobal.h(899) : unsigned int uint'
1> or 'g:\users\eggman\downloads\ogresdk_vc9_v1-7-1\include\ogre\OgrePrerequisites.h(108) : Ogre::uint'
1>Build log was saved at "file://g:\Users\Eggman\Documents\Visual Studio 2008\Projects\Irrational Engine v1.0\Irrational Engine v1.0\Debug\BuildLog.htm"
1>Irrational Engine v1 - 1 error(s), 0 warning(s)@the error seems to come from the 1>moc_cirrationalengine.cpp file generated by the Qt4 application project i used to make this project (Meaning the wizard) Hmmmm, I'm really not sure what else to post other then that maybe this:
@/****************************************************************************
** Meta object code from reading C++ file 'cirrationalengine.h'
**
** Created: Thu Oct 21 18:02:43 2010
** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/#include "../../cirrationalengine.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'cirrationalengine.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 62
#error "This file was generated using the moc from 4.7.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endifQT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_CIrrationalEngine[] = {// content:
5, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount// slots: signature, parameters, type, tag, flags
19, 18, 18, 18, 0x08,0 // eod
};
static const char qt_meta_stringdata_CIrrationalEngine[] = {
"CIrrationalEngine\0\0ShowMaterialEditor()\0"
};const QMetaObject CIrrationalEngine::staticMetaObject = {
{ &QMainWindow::staticMetaObject, qt_meta_stringdata_CIrrationalEngine,
qt_meta_data_CIrrationalEngine, 0 }
};#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &CIrrationalEngine::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATIONconst QMetaObject *CIrrationalEngine::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}void CIrrationalEngine::qt_metacast(const char _clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_CIrrationalEngine))
return static_cast<void>(const_cast< CIrrationalEngine>(this));
return QMainWindow::qt_metacast(_clname);
}int CIrrationalEngine::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: ShowMaterialEditor(); break;
default: ;
}
_id -= 1;
}
return _id;
}
QT_END_MOC_NAMESPACE
@
like i said, i don't know if that will do let me know if u need anything else, I'm in no rush (I got Ogre to render in a Qt4 widget, took a couple days and a lot of trial and error) -
Does cirrationalengine.h contain using instruction too? If yes try to remove it from there.
-
Both Qt and Ogre typedef uint. Fortunately, Ogre uses a namespace so you just need to remove all of the "using namespace Ogre;" statements from your source code. Then, you will have to prepend all the Ogre types with Ogre:: (so String becomes Ogre::String, FrameListener becomes Ogre::FrameListener, and so on).
Also, I don't know if you are using your own FrameListener or the one that comes with Ogre (ExampleFrameListener) but the example one had the "using namespace Ogre;" statement in it so you'd have to either implement your own FrameListener or modify ExampleFrameListener.h as well.
-
yea, i figured that out, thanks, one thing i've noticed i was creating the material editor window and got a few access violations, also, seems like when u open the editor and close it and open it again, that gives a "window already exists" exception from Ogre, there has to be a way to make it so when the window is closed it destroys the RenderWindow then when the editpr window is reopened recreates it......Hmmm