Thu, 04/04/2002 - 08:50
Hello,
I am trying to compile the QT sample coming with Open CASCADE 4.0, I used Qt_mt230nc,
but got the following linking problems, I would appreciate if anyone can let me know the reason, thanks!
Linking...
Creating library Debug/Sample.lib and object Debug/Sample.exp
LIBCD.lib(crt0init.obj) : warning LNK4098: defaultlib "msvcrt.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
Translate.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
ViewOperations.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
moc_Translate.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
moc_Transparency.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
moc_View.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
moc_ViewOperations.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
moc_ExportCSFDB.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
moc_ExportSTEP.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
moc_Material.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
moc_MDIWindow.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
Application.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
MDIWindow.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
moc_Application.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
moc_Document.obj : error LNK2001: unresolved external symbol "class QApplication * qApp" (?qApp@@3PAVQApplication@@A)
Application.obj : error LNK2001: unresolved external symbol "public: static class QString QString::null" (?null@QString@@2V1@A)
MAIN.obj : error LNK2001: unresolved external symbol "public: static class QString QString::null" (?null@QString@@2V1@A)
MDIWindow.obj : error LNK2001: unresolved external symbol "public: static class QString QString::null" (?null@QString@@2V1@A)
Translate.obj : error LNK2001: unresolved external symbol "public: static class QString QString::null" (?null@QString@@2V1@A)
View.obj : error LNK2001: unresolved external symbol "private: static struct QStringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
ViewOperations.obj : error LNK2001: unresolved external symbol "private: static struct QStringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
MAIN.obj : error LNK2001: unresolved external symbol "private: static struct QStringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
Material.obj : error LNK2001: unresolved external symbol "private: static struct QStringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
MDIWindow.obj : error LNK2001: unresolved external symbol "private: static struct QStringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
Translate.obj : error LNK2001: unresolved external symbol "private: static struct QStringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
Application.obj : error LNK2001: unresolved external symbol "private: static struct QStringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
Document.obj : error LNK2001: unresolved external symbol "private: static struct QStringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
ExportCSFDB.obj : error LNK2001: unresolved external symbol "private: static struct QStringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
ExportSTEP.obj : error LNK2001: unresolved external symbol "private: static struct QStringData * QString::shared_null" (?shared_null@QString@@0PAUQStringData@@A)
MDIWindow.obj : error LNK2001: unresolved external symbol "public: static class QCursor & Qt::waitCursor" (?waitCursor@Qt@@2AAVQCursor@@A)
Translate.obj : error LNK2001: unresolved external symbol "public: static class QCursor & Qt::waitCursor" (?waitCursor@Qt@@2AAVQCursor@@A)
View.obj : error LNK2001: unresolved external symbol "public: static class QCursor & Qt::waitCursor" (?waitCursor@Qt@@2AAVQCursor@@A)
ViewOperations.obj : error LNK2001: unresolved external symbol "public: static class QCursor & Qt::waitCursor" (?waitCursor@Qt@@2AAVQCursor@@A)
MDIWindow.obj : error LNK2001: unresolved external symbol "private: static class QWidget * QApplication::main_widget" (?main_widget@QApplication@@0PAVQWidget@@A)
Translate.obj : error LNK2001: unresolved external symbol "private: static class QWidget * QApplication::main_widget" (?main_widget@QApplication@@0PAVQWidget@@A)
ViewOperations.obj : error LNK2001: unresolved external symbol "private: static class QWidget * QApplication::main_widget" (?main_widget@QApplication@@0PAVQWidget@@A)
View.obj : error LNK2001: unresolved external symbol "public: static class QColor & Qt::white" (?white@Qt@@2AAVQColor@@A)
Debug/Sample.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe.
Sample.exe - 37 error(s), 1 warning(s)
Sun, 04/07/2002 - 00:09
There are some changes in the code to make VC++ compile it correctly.
First, in LibDefinition.cpp
#pragma comment (lib , "qt221.lib")
becomes
#pragma comment (lib , "qt-mt230nc.lib")
Then, you have to replace the code in main.cxx by the following (the added lines are between /////////////////)
#include
#include
#include
#include
#include "Application.h"
///////////////////////////
QApplication* qApp;
QString QString::null="";
QStringData * QString::shared_null=0;
QWidget * QApplication::main_widget=0;
///////////////////////////
int main(int argc, char* argv[])
{
QApplication a( argc, argv );
///////////////////////////
qApp=&a;
///////////////////////////
QTranslator strTrans( 0 );
strTrans.load( "string.qm", "res" );
a.installTranslator( &strTrans );
QTranslator iconTrans( 0 );
iconTrans.load( "icon.qm", "res" );
a.installTranslator( &iconTrans );
QString dir("res/");
ApplicationWindow * mw = new ApplicationWindow();
///////////////////////////
a.setMainWidget(mw);
///////////////////////////
mw->setCaption( QObject::tr("TIT_SAMPLE") );
mw->setIcon( QPixmap(dir+QObject::tr("ICON_SAMPLE")) );
mw->show();
// QObject::connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
QObject::connect( &a, SIGNAL(lastWindowClosed()), mw, SLOT(onQuit()) );
QObject::connect( mw, SIGNAL(sendQuit()), &a, SLOT(quit()) );
// QObject::connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
/* Initialize the desktop and 'ShapeViewer' application
*/
return a.exec();
}
Then, you have to change Qt::waitCursor by WaitCursor in the whole project (translate.cpp, view.cpp, viewoperation.cpp, mdiwindow.cpp) and finally replace Qt::white by QColor(0,0,0).
I don't if it is the simpliest way to compile but it works on my computer !
Olivier.
Wed, 04/10/2002 - 16:11
Hi Jeff,
We've been using Cascade and Open Cascade with Qt for many years now and they work fine together. If you want to recompile the Qt on your Windows machine, you will need the Qt distribution installed first, I don't you if you got it because it's not free on Windows (only on Unix and Linux). You don't have to redefine
QApplication* qApp;
QString QString::null="";
QStringData * QString::shared_null=0;
QWidget * QApplication::main_widget=0;
like Olivier suggest, these are already define if you build with the distribution. If you really want to try it on Windows, you might want to evaluate Qt on Windows for free (30 days) at (http://www.trolltech.com/products/qt/evaluate.html?cid=Qt).
Good Luck,
Francois.
François Lauzon, Ing. Stag.
Software Development Coordinator
DBM Reflex Inc.
1620 boul. Dagenais ouest
Laval, Québec
Email: Francois.Lauzon@dbmreflex.com
Wed, 04/17/2002 - 07:30
Thanks Olivier and Francois for your helps,
I did as Olivier told, it works for me now.
I did install Qt2.3 for Microsoft Windows on my machine, the eveluation edition of Qt is version 3.0, for 30 days only. So I did not try Qt3.0.
The sample was compiled on Qt2.21(according to the document), I just wonder if the verision changed, we have to change the source codes, what is the advantage of Qt?
Or, maybe it is just a bug of the sample.
Francois, did you compile on Qt3.0 without problems?
Olivier, thanks again, I know you must be very busy with your stuff, hope to see your projects posted here soon.
Best Regards,
Jeff
Wed, 04/17/2002 - 16:08
Hi Jeff,
I've use QT1.4, QT2.X and QT3.X with Open Cascade. The only thing you have to do to compile with version 3 is to remove the moc file (moc_*.*) and recompile the application, Qt with generate new moc files that will work with version 3.0. You don't have to change any source code.
The advantages of using Qt for us was that it's available on all the platform we are developping (IRIX and NT), it's the same source code no mather which platform we choose, we've got the source code, and it's fast and work really well, a lot better than MFC or Motif.
Francois.
François Lauzon, Ing. Stag.
Software Development Coordinator
DBM Reflex Inc.
1620 boul. Dagenais ouest
Laval, Québec
Email: Francois.Lauzon@dbmreflex.com
Sun, 09/14/2003 - 03:03
Hello,
Has anyone tried it on Linux? I have not been able to get the sample to work with OCC 5.0 on RedHat with gcc-3.2.7 and qt-2.3 or qt-3.0 but could not get it to compile. The problems occur during linking.
Worawut W.
Wed, 02/01/2006 - 14:00
i am new to occ i am not able to compile QT sample program in linux platform, when i was compiling i got the following error
In file included from Application.h:4,
from Application.cxx:1:
Document.h:9:38: AIS_InteractiveContext.hxx: No such file or directory
Document.h:10:26: V3d_Viewer.hxx: No such file or directory
In file included from Application.h:4,
from Application.cxx:1:
Document.h:23: error: `AIS_InteractiveContext' was not declared in this scope
Document.h:23: error: variable declaration is not allowed here
Document.h:23: error: syntax error before `(' token
Document.h:46: error: `V3d_Viewer' was not declared in this scope
Document.h:46: error: variable declaration is not allowed here
Document.h:46: error: syntax error before `(' token
Document.h:57: error: `V3d_Viewer' was not declared in this scope
Document.h:57: error: variable declaration is not allowed here
Document.h:57: error: syntax error before `;' token
Document.h:58: error: `AIS_InteractiveContext' was not declared in this scope
Document.h:58: error: variable declaration is not allowed here
Document.h:58: error: syntax error before `;' token
In file included from Application.cxx:4:
Translate.h:6:38: AIS_InteractiveContext.hxx: No such file or directory
Translate.h:7:41: TopTools_HSequenceOfShape.hxx: No such file or directory
In file included from Application.cxx:4:
Translate.h:21: error: `AIS_InteractiveContext' was not declared in this scope
Translate.h:21: error: syntax error before `&' token
Translate.h:22: error: `AIS_InteractiveContext' was not declared in this scope
Translate.h:22: error: syntax error before `&' token
Translate.h:27: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:27: error: variable declaration is not allowed here
Translate.h:27: error: syntax error before `(' token
Translate.h:29: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:29: error: syntax error before `&' token
Translate.h:29: error: `bool Translate::exportModel(...)' and `bool Translate::exportModel(...)' cannot be overloaded
Translate.h:32: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:32: error: variable declaration is not allowed here
Translate.h:32: error: syntax error before `(' token
Translate.h:34: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:34: error: variable declaration is not allowed here
Translate.h:34: error: syntax error before `(' token
Translate.h:35: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:35: error: variable declaration is not allowed here
Translate.h:35: error: syntax error before `(' token
Translate.h:36: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:36: error: variable declaration is not allowed here
Translate.h:36: error: syntax error before `(' token
Translate.h:37: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:37: error: variable declaration is not allowed here
Translate.h:37: error: syntax error before `(' token
Translate.h:39: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:39: error: syntax error before `&' token
Translate.h:40: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:40: error: syntax error before `&' token
Translate.h:41: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:41: error: syntax error before `&' token
Translate.h:42: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:42: error: syntax error before `&' token
Translate.h:43: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:43: error: syntax error before `&' token
Translate.h:44: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:44: error: syntax error before `&' token
Translate.h:46: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:46: error: syntax error before `&' token
In file included from Application.cxx:5:
View.h:8:38: AIS_InteractiveContext.hxx: No such file or directory
View.h:9:24: V3d_View.hxx: No such file or directory
In file included from Application.cxx:5:
View.h:25: error: syntax error before `(' token
View.h:30: error: `Standard_CString' was not declared in this scope
View.h:30: error: syntax error before `)' token
View.h:35: error: type specifier omitted for parameter `TopAbs_ShapeEnum'
View.h:35: error: syntax error before `,' token
View.h:37: error: `TopAbs_ShapeEnum' was not declared in this scope
View.h:37: error: syntax error before `)' token
View.h:39: error: syntax error before `static'
View.h:41: error: syntax error before `static'
View.h:43: error: syntax error before `static'
View.h:100: error: `V3d_View' was not declared in this scope
View.h:100: error: variable declaration is not allowed here
View.h:100: error: syntax error before `;' token
View.h:101: error: `AIS_InteractiveContext' was not declared in this scope
View.h:101: error: variable declaration is not allowed here
View.h:101: error: syntax error before `;' token
View.h:103: error: 'Standard_Integer' is used as a type, but is not defined as a type.
View.h:104: error: 'Standard_Integer' is used as a type, but is not defined as a type.
View.h:105: error: 'Standard_Integer' is used as a type, but is not defined as a type.
View.h:106: error: 'Standard_Integer' is used as a type, but is not defined as a type.
View.h:107: error: 'Quantity_Factor' is used as a type, but is not defined as a type.
View.h:108: error: 'Standard_Boolean' is used as a type, but is not defined as a type.
Application.h: In constructor `ApplicationWindow::ApplicationWindow()':
Application.h:79: warning: `ApplicationWindow::myExportPopup' will be initialized after
Application.h:77: warning: `QPopupMenu*ApplicationWindow::myWindowPopup'
Application.cxx:28: warning: when initialized here
Application.h:77: warning: `ApplicationWindow::myWindowPopup' will be initialized after
Application.h:76: warning: `QPopupMenu*ApplicationWindow::myFilePopup'
Application.cxx:28: warning: when initialized here
Application.h:76: warning: `ApplicationWindow::myFilePopup' will be initialized after
Application.h:75: warning: `QToolBar*ApplicationWindow::myCasCadeBar'
Application.cxx:28: warning: when initialized here
Application.h:75: warning: `ApplicationWindow::myCasCadeBar' will be initialized after
Application.h:74: warning: `QToolBar*ApplicationWindow::myStdToolBar'
Application.cxx:28: warning: when initialized here
Application.cxx: In member function `void ApplicationWindow::createCasCadeOperations()':
Application.cxx:165: error: `Graphic3d_NOM_BRASS' undeclared (first use this function)
Application.cxx:165: error: (Each undeclared identifier is reported only once for each function it appears in.)
Application.cxx:170: error: `Graphic3d_NOM_BRONZE' undeclared (first use this function)
Application.cxx:175: error: `Graphic3d_NOM_COPPER' undeclared (first use this function)
Application.cxx:180: error: `Graphic3d_NOM_GOLD' undeclared (first use this function)
Application.cxx:185: error: `Graphic3d_NOM_PEWTER' undeclared (first use this function)
Application.cxx:190: error: `Graphic3d_NOM_PLASTER' undeclared (first use this function)
Application.cxx:195: error: `Graphic3d_NOM_PLASTIC' undeclared (first use this function)
Application.cxx:200: error: `Graphic3d_NOM_SILVER' undeclared (first use this function)
Application.cxx: In member function `void ApplicationWindow::onExport()':
Application.cxx:454: warning: unused variable `bool stat'
Application.cxx: In member function `bool ApplicationWindow::translate(int, bool)':
Application.cxx:500: error: `AIS_InteractiveContext' undeclared (first use this function)
Application.cxx:500: error: `Handle' undeclared (first use this function)
Application.cxx:500: error: syntax error before `=' token
Application.cxx:503: error: `context' undeclared (first use this function)
Application.cxx:499: warning: unused variable `Document*doc'
Application.cxx: In member function `void ApplicationWindow::onSelectionChanged()':
Application.cxx:559: error: `Handle' undeclared (first use this function)
Application.cxx:559: error: syntax error before `=' token
Application.cxx:558: warning: unused variable `Document*doc'
make: *** [Application.o] Error 1
Sun, 04/06/2003 - 03:07
all you need is the following defined in your MSVC project settings:
WIN32,NDEBUG,_WINDOWS,_MBCS,QT_DLL,UNICODE,QT_THREAD_SUPPORT,NO_DEBUG
good luck,
Ravi
Sat, 09/13/2003 - 05:15
ASS2.obj : error LNK2001: unresolved external symbol "public: void __thiscall Datetime::setDate(int,int,int)" (?setDate@Datetime@@QAEXHHH@Z)