List:GUI Tools« Previous MessageNext Message »
From:Adam Majer Date:February 28 2003 6:58pm
Subject:[PATCH] Re: Problems compiling in windows wiht Qt 3.1.1
View as plain text  
Hi,

I talked to Trolltech about this and it turns out that it is a bug
in MyCC/bcc55 :) Apparently Borland does not allow calling of a function
called main() so they had to do a workaround with some wrapper called
qMain(). So that's the bug in BCC55.

To fix MyCC, all you have to do is put a Qt header in the file with
main(). Here's what they wrote exactly,

 This applies only for window, but not console applications. It is a very
 rare case that somebody write a window application with Qt, but does
 not include any Qt headers in the file that has main().

 In these rare cases, the right solution is to include qwindowdefs.h in
 the file with main().

There are also a number of other problems with using obsolete 
Qt functions in MyCC that do not compile with Borland - says
it's ambiguous. I'm attaching a patch file that fixes all those 
problems against the 0.8.10 version.

- Adam



On Fri, Feb 28, 2003 at 04:04:30AM -0600, Jorge del Conde wrote:
> Hi!
> 
> I will look into this problem for 0.8.12.  Since I have never used BCC 5
> with Qt I can't say for sure if the bug is in the mysqlcc code, the pro
> files or anything else, but since the code compiles without problems in VC
> and several Unix/Linux compilers I'm sure this should be an easy fix.
> 
> If you happen to get mysqlcc compiling with BCC, can you please send me a
> patch ?
> 
> Regards,
> Jorge
> --
> For technical support contracts, visit https://order.mysql.com/?ref=mjdc
>    __  ___     ___ ____  __
>   /  |/  /_ __/ __/ __ \/ /    Mr. Jorge del Conde <jorge@stripped>
>  / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Full-Time Developer
> /_/  /_/\_, /___/\___\_\___/   Mexico City, Mexico
>        <___/   www.mysql.com
> 
> MySQL Users Conference and Expo
> http://www.mysql.com/events/uc2003/
> 
> 
> ----- Original Message -----
> From: "Adam Majer" <adamm@stripped>
> To: <mycc@stripped>
> Sent: Friday, February 14, 2003 12:03 PM
> Subject: Problems compiling in windows wiht Qt 3.1.1
> 
> 
> > Hi,
> >
> > I've compiled MyCC with Qt 3.1.1 but it fails to link. I get
> > this error message
> >
> > Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
> > Error: Unresolved external 'qMain(int, char * *)' referenced from
> F:\QT\3.1.1\LIB\QTMAIN.LIB|qtmain_win
> >
> > Does anyone know how to resolv this issue?
> >
> > - Adam
> >
> > PS. The sources to MyCC seem to suggest that it is to be compiled with
> > MSVC. But since it uses Qt, one should be able to compile with it
> > an laternate compiler like Borland BCC 5.5.1 which is supported
> > by Trolltech.
> >
> > I've asked Trolltech about this problem and their response suggests
> > that the problem is with the MyCC sources.. Any ideas??
> >
> >
> > ---------------------------------------------------------------------
> > Before posting please check: http://www.mysql.com/products/mycc/index.html
> > To unsubscribe, send email to
> mysqlcc-unsubscribe-jorge=mysql.com@stripped
> >
> 

diff --strip-trailing-cr -ru mysqlcc-0.8.10-src/shared/include/CMySQLQuery.h
mysqlcc-0.8.10-src-new/shared/include/CMySQLQuery.h
--- mysqlcc-0.8.10-src/shared/include/CMySQLQuery.h	2003-02-10 02:23:18.000000000 -0600
+++ mysqlcc-0.8.10-src-new/shared/include/CMySQLQuery.h	2003-02-28 18:38:12.000000000
-0600
@@ -56,7 +56,7 @@
 
 class CMySQLQuery : public QObject
 {
-  Q_OBJECT;
+  Q_OBJECT
   
 public:
   CMySQLQuery(CMySQL *m);
diff --strip-trailing-cr -ru mysqlcc-0.8.10-src/shared/src/shared.cpp
mysqlcc-0.8.10-src-new/shared/src/shared.cpp
--- mysqlcc-0.8.10-src/shared/src/shared.cpp	2003-02-10 02:23:18.000000000 -0600
+++ mysqlcc-0.8.10-src-new/shared/src/shared.cpp	2003-02-28 18:38:14.000000000 -0600
@@ -41,7 +41,7 @@
   for (uint i=0; i < str.length(); i++)
   {
     QChar tmp = str.at(i);
-    tmpstr += (tmp == from) ? to : tmp;		
+    tmpstr += ((tmp == from) ? to : QString(tmp));		
   }
   return tmpstr;
 }
diff --strip-trailing-cr -ru mysqlcc-0.8.10-src/src/CAdministrationWindow.cpp
mysqlcc-0.8.10-src-new/src/CAdministrationWindow.cpp
--- mysqlcc-0.8.10-src/src/CAdministrationWindow.cpp	2003-02-10 02:23:18.000000000 -0600
+++ mysqlcc-0.8.10-src-new/src/CAdministrationWindow.cpp	2003-02-28 18:38:14.000000000
-0600
@@ -226,7 +226,7 @@
   menu->insertItem(getPixmapIcon("clearGridIcon"), tr("Clear Grid"), MENU_CLEAR_GRID);
   menu->setItemEnabled (MENU_CLEAR_GRID, !isBlocked());
   menu->insertSeparator();
-  menu->insertItem(is_traditional ? tr("Extended Mode") : tr("Traditional Mode"),
MENU_TRADITIONAL);
+  menu->insertItem((const QString&)((is_traditional) ? tr("Extended Mode") :
tr("Traditional Mode")), MENU_TRADITIONAL);
   
   int res = menu->exec(pos);
   delete menu;
diff --strip-trailing-cr -ru mysqlcc-0.8.10-src/src/CConsoleWindow.cpp
mysqlcc-0.8.10-src-new/src/CConsoleWindow.cpp
--- mysqlcc-0.8.10-src/src/CConsoleWindow.cpp	2003-02-10 02:23:18.000000000 -0600
+++ mysqlcc-0.8.10-src-new/src/CConsoleWindow.cpp	2003-02-28 18:38:14.000000000 -0600
@@ -79,7 +79,7 @@
   widgetstack->addWidget(new CShowDatabaseGroupProperties(widgetstack), (int)
CDatabaseListViewItem::USER_ADMINISTRATION);
     
   treepanelwindow = new CDockWindow(CDockWindow::InDock, this, isApplicationWindow() ?
"TreePanelWindow" : "TreePanelWindow2");
-  treepanelwindow->setCaption(isApplicationWindow() ? tr("MySQL Servers") : tr("Tree
Panel"));
+  treepanelwindow->setCaption((const QString&)(isApplicationWindow() ? tr("MySQL
Servers") : tr("Tree Panel")));
   dbListView = new CDatabaseListView(this, treepanelwindow, "DatabaseListView");
     
   treepanelwindow->setWidget(dbListView);
diff --strip-trailing-cr -ru mysqlcc-0.8.10-src/src/CInfoDialog.cpp
mysqlcc-0.8.10-src-new/src/CInfoDialog.cpp
--- mysqlcc-0.8.10-src/src/CInfoDialog.cpp	2003-02-10 02:23:18.000000000 -0600
+++ mysqlcc-0.8.10-src-new/src/CInfoDialog.cpp	2003-02-28 18:38:14.000000000 -0600
@@ -15,6 +15,12 @@
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
   MA 02111-1307, USA 
 */
+
+#if defined(__BCPLUSPLUS__)  // Disable the "Too many error or warning messages" error
+#pragma warn -8080
+#endif
+
+
 #include "CInfoDialog.h"
 #include <qlabel.h>
 #include <qpushbutton.h>
diff --strip-trailing-cr -ru mysqlcc-0.8.10-src/src/CSqlEditor/completion.cpp
mysqlcc-0.8.10-src-new/src/CSqlEditor/completion.cpp
--- mysqlcc-0.8.10-src/src/CSqlEditor/completion.cpp	2003-02-10 02:23:18.000000000 -0600
+++ mysqlcc-0.8.10-src-new/src/CSqlEditor/completion.cpp	2003-02-28 18:38:14.000000000
-0600
@@ -162,7 +162,7 @@
   qDebug("EditorCompletion::addCompletionEntry()");
 #endif
 
-  QChar key = case_sensitive ? s[0] : s.lower()[ 0 ];
+  QChar key = case_sensitive ? QChar(s[0]) : QChar(s.lower()[0]);
   QMap<QChar, QStringList>::Iterator it = completionMap.find( key );
  
   if ( it == completionMap.end() )
@@ -204,7 +204,7 @@
   if ( doc )
     ( (EditorCompletion*)this )->updateCompletionMap( doc );
   
-  QChar key = case_sensitive ? s[0] : s.lower()[ 0 ];
+  QChar key = case_sensitive ? QChar(s[0]) : QChar(s.lower()[0]);
   QMap<QChar, QStringList>::ConstIterator it = completionMap.find( key );
   if ( it == completionMap.end() )
     return QValueList<CompletionEntry>();
@@ -342,12 +342,12 @@
     if ( lst.count() == 1 )
     {
       if (case_sensitive)
-        curEditor->insert( lst.first().text.mid( completionOffset, 0xFFFFFF ), TRUE );
+        curEditor->insert( lst.first().text.mid( completionOffset, 0xFFFFFF ),
(unsigned int)QTextEdit::RedoIndentation );
       else
       {
         for (unsigned int x = 1; x <= searchString.length(); x++)
           curEditor->doKeyboardAction (QTextEdit::ActionBackspace);  
-        curEditor->insert( lst.first().text, TRUE );
+        curEditor->insert( lst.first().text, (unsigned int)QTextEdit::RedoIndentation
);
       }
     }
     else
@@ -456,7 +456,7 @@
       curEditor->doKeyboardAction(QTextEdit::ActionBackspace);
   }
 
-  curEditor->insert( s, TRUE );
+  curEditor->insert( s, (unsigned int)QTextEdit::RedoIndentation );
   completionPopup->close();
   curEditor->setFocus();
 
diff --strip-trailing-cr -ru mysqlcc-0.8.10-src/src/CTable.cpp
mysqlcc-0.8.10-src-new/src/CTable.cpp
--- mysqlcc-0.8.10-src/src/CTable.cpp	2003-02-10 02:23:18.000000000 -0600
+++ mysqlcc-0.8.10-src-new/src/CTable.cpp	2003-02-28 18:38:14.000000000 -0600
@@ -22,6 +22,11 @@
 #include <qdatetime.h>
 #include <stdlib.h>
 
+#ifdef __BCPLUSPLUS__
+#include <search.h>
+#endif
+
+
 CTable::CTable(QWidget * parent, const char * name)
 : QTable(parent, name)
 {
diff --strip-trailing-cr -ru mysqlcc-0.8.10-src/src/CUserAdminWindow.cpp
mysqlcc-0.8.10-src-new/src/CUserAdminWindow.cpp
--- mysqlcc-0.8.10-src/src/CUserAdminWindow.cpp	2003-02-10 02:23:18.000000000 -0600
+++ mysqlcc-0.8.10-src-new/src/CUserAdminWindow.cpp	2003-02-28 18:38:14.000000000 -0600
@@ -214,7 +214,7 @@
   
   applyButton = new QPushButton(centralWidget(), "applyButton");
   applyButton->setMinimumSize(QSize(60, 0));
-  applyButton->setText(is_editing ? trUtf8("&Apply") : trUtf8("&Add"));
+  applyButton->setText((const QString&)(is_editing ? trUtf8("&Apply") :
trUtf8("&Add")));
   applyButton->setDefault(true);
   QWhatsThis::add(applyButton, trUtf8("Click here to apply changes any you have made."));
   Layout2->addWidget(applyButton);
@@ -297,7 +297,7 @@
   {
     setWindowCaption();
     deleteButton->setEnabled(is_editing);
-    applyButton->setText(is_editing ? trUtf8("&Apply") : trUtf8("&Add"));
+    applyButton->setText((const QString&)(is_editing ? trUtf8("&Apply") :
trUtf8("&Add")));
   }
 }
 
diff --strip-trailing-cr -ru mysqlcc-0.8.10-src/src/main.cpp
mysqlcc-0.8.10-src-new/src/main.cpp
--- mysqlcc-0.8.10-src/src/main.cpp	2003-02-10 02:23:18.000000000 -0600
+++ mysqlcc-0.8.10-src-new/src/main.cpp	2003-02-28 18:44:10.000000000 -0600
@@ -16,7 +16,9 @@
   MA 02111-1307, USA 
 */
 #include "mysqlcc_main.h"
-#ifdef WIN32
+#include <qwindowdefs.h>
+
+#if defined( WIN32 )
 
 // Win32 platforms currently don't support command line parameters
 int main(int argc, char *argv[])
diff --strip-trailing-cr -ru mysqlcc-0.8.10-src/win32/mysqlcc.rc
mysqlcc-0.8.10-src-new/win32/mysqlcc.rc
--- mysqlcc-0.8.10-src/win32/mysqlcc.rc	2003-01-16 14:04:02.000000000 -0600
+++ mysqlcc-0.8.10-src-new/win32/mysqlcc.rc	2003-02-28 18:38:14.000000000 -0600
@@ -7,7 +7,7 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+// #include "afxres.h"
 
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS

Thread
Problems compiling in windows wiht Qt 3.1.1Adam Majer14 Feb
  • Re: Problems compiling in windows wiht Qt 3.1.1Jorge del Conde28 Feb
    • [PATCH] Re: Problems compiling in windows wiht Qt 3.1.1Adam Majer28 Feb