OlafSt
6th September 2010, 10:07
Hello there,
first, let me warn you: I'm a very, very, very bloody beginner to all this stuff... I'm used to use Delphi since Version 1 and C++ Builder... I'm not very familiar anymore with giant command lines, using command line tools and so on.
However. I downloaded the Qt-Toolkit from here (http://qt.nokia.com/downloads/sdk-windows-cpp) and installed it. Compiling some of the examples is no Problem, so I went on, to my first simple project.
Here I want to call "CoInitializeEx(...)" - but whatever I try, the result is the same: undefined reference to 'CoInitializeEx@8'. What am I doing wrong ?
Here's my code (don't look too sharp please :)):
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "windows.h"
#include "objbase.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
int DriveMask=0, i=0, j=0;
TCHAR szTemp[512], *p;
ui->setupUi(this);
//Interessanterweise brauchen wir dieses manuelle Connecten gar nicht.
//Wir implementieren einfach einen "on_[ControlName]_[Event]()"-Handler...
//Läßt sich aber abschalten via [ControlName]->setAutoDefault(false);
//connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(pushButtonC licked()));
//pushButton not declared in this scope - wo ist der Button dann ?!?!?
//ui-> ist der Scope, hehe ;-)
//Just for fun ;)
::CoInitializeEx(NULL,1);
//Ermitteln aller Laufwerke und eintragen derselben in die ComboBox
szTemp[0]='\0';
DriveMask=GetLogicalDrives(); j=1;
GetLogicalDriveStrings(511, szTemp);
p=szTemp;
for(i=0;i<26;i++)
{
if ((DriveMask & j) == j)
{
//Lese VolumeLabel aus dem Drive,wenn möglich
}
j <<= 1;
}
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
close();
}
And this is the resulting Log when pressing F5 to run this incomplete program:
Führe Build-Schritte für Projekt Test01 aus...
Unveränderte Konfiguration, qmake-Schritt wird übersprungen.
Starte: "D:/Qt/2010.04/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `D:/QTProjects/Test01-build-desktop'
D:/Qt/2010.04/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `D:/QTProjects/Test01-build-desktop'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\Qt\2010.04\qt\include\QtCore" -I"..\..\Qt\2010.04\qt\include\QtGui" -I"..\..\Qt\2010.04\qt\include" -I"..\..\Qt\2010.04\qt\include\ActiveQt" -I"debug" -I"." -I"..\Test01" -I"." -I"..\..\Qt\2010.04\qt\mkspecs\win32-g++" -o debug\mainwindow.o ..\Test01\mainwindow.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\Test01.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -L"d:\Qt\2010.04\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `D:/QTProjects/Test01-build-desktop'
mingw32-make: Leaving directory `D:/QTProjects/Test01-build-desktop'
debug/mainwindow.o: In function `MainWindow':
D:\QTProjects\Test01-build-desktop/../Test01/mainwindow.cpp:22: undefined reference to `CoInitializeEx@8'
D:\QTProjects\Test01-build-desktop/../Test01/mainwindow.cpp:22: undefined reference to `CoInitializeEx@8'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\Test01.exe] Error 1
mingw32-make: *** [debug] Error 2
The Prozess "D:/Qt/2010.04/mingw/bin/mingw32-make.exe" wurde mit dem Rückgabewert %2 beendet.
Fehler beim Erstellen des Projekts Test01 (Ziel: Desktop)
Beim Ausführen des Build-Schritts 'Make'
first, let me warn you: I'm a very, very, very bloody beginner to all this stuff... I'm used to use Delphi since Version 1 and C++ Builder... I'm not very familiar anymore with giant command lines, using command line tools and so on.
However. I downloaded the Qt-Toolkit from here (http://qt.nokia.com/downloads/sdk-windows-cpp) and installed it. Compiling some of the examples is no Problem, so I went on, to my first simple project.
Here I want to call "CoInitializeEx(...)" - but whatever I try, the result is the same: undefined reference to 'CoInitializeEx@8'. What am I doing wrong ?
Here's my code (don't look too sharp please :)):
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "windows.h"
#include "objbase.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
int DriveMask=0, i=0, j=0;
TCHAR szTemp[512], *p;
ui->setupUi(this);
//Interessanterweise brauchen wir dieses manuelle Connecten gar nicht.
//Wir implementieren einfach einen "on_[ControlName]_[Event]()"-Handler...
//Läßt sich aber abschalten via [ControlName]->setAutoDefault(false);
//connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(pushButtonC licked()));
//pushButton not declared in this scope - wo ist der Button dann ?!?!?
//ui-> ist der Scope, hehe ;-)
//Just for fun ;)
::CoInitializeEx(NULL,1);
//Ermitteln aller Laufwerke und eintragen derselben in die ComboBox
szTemp[0]='\0';
DriveMask=GetLogicalDrives(); j=1;
GetLogicalDriveStrings(511, szTemp);
p=szTemp;
for(i=0;i<26;i++)
{
if ((DriveMask & j) == j)
{
//Lese VolumeLabel aus dem Drive,wenn möglich
}
j <<= 1;
}
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
close();
}
And this is the resulting Log when pressing F5 to run this incomplete program:
Führe Build-Schritte für Projekt Test01 aus...
Unveränderte Konfiguration, qmake-Schritt wird übersprungen.
Starte: "D:/Qt/2010.04/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `D:/QTProjects/Test01-build-desktop'
D:/Qt/2010.04/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `D:/QTProjects/Test01-build-desktop'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\Qt\2010.04\qt\include\QtCore" -I"..\..\Qt\2010.04\qt\include\QtGui" -I"..\..\Qt\2010.04\qt\include" -I"..\..\Qt\2010.04\qt\include\ActiveQt" -I"debug" -I"." -I"..\Test01" -I"." -I"..\..\Qt\2010.04\qt\mkspecs\win32-g++" -o debug\mainwindow.o ..\Test01\mainwindow.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\Test01.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -L"d:\Qt\2010.04\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `D:/QTProjects/Test01-build-desktop'
mingw32-make: Leaving directory `D:/QTProjects/Test01-build-desktop'
debug/mainwindow.o: In function `MainWindow':
D:\QTProjects\Test01-build-desktop/../Test01/mainwindow.cpp:22: undefined reference to `CoInitializeEx@8'
D:\QTProjects\Test01-build-desktop/../Test01/mainwindow.cpp:22: undefined reference to `CoInitializeEx@8'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\Test01.exe] Error 1
mingw32-make: *** [debug] Error 2
The Prozess "D:/Qt/2010.04/mingw/bin/mingw32-make.exe" wurde mit dem Rückgabewert %2 beendet.
Fehler beim Erstellen des Projekts Test01 (Ziel: Desktop)
Beim Ausführen des Build-Schritts 'Make'