Sunday, July 6th 2008, 2:01pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

dsoodak

Beginner

Posts: 8

Location: Florida

Occupation: Instrument design, firmware, software

1

Sunday, May 11th 2008, 6:13pm

QtTutorial 1- Hello World! example in Windows Vista

In this page of the Qt assistant it says to make a file named "main.cpp" file with the following:

#include <QApplication>
#include <QPushButton>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

QPushButton hello("Hello world!");
hello.resize(100, 30);

hello.show();
return app.exec();
}


I finally got to the point where
qmake -project
and
qmake
commands both work(it built a project file and make files).

but when I entered the "make" command it returned a couple thousand lines of output, mostly error messages, starting with

main.cpp:1: error: expected constructor, destructor, or type conversion
before "file"
main.cpp:1: error: expected `,' or `;' before "file"

Does anyone have any idea what went wrong?


Note; this is the project file:

######################################################################
# Automatically generated by qmake (2.01a) Sun May 11 13:07:28 2008
######################################################################

TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

# Input
SOURCES += main.cpp
  • Go to the top of the page

2

Sunday, May 11th 2008, 6:36pm

give the exact error messages (about 20 first lines should be sufficient)
Nicolas
  • Go to the top of the page

3

Sunday, May 11th 2008, 6:41pm

RE: QtTutorial 1- Hello World! example in Windows Vista

if you are working in msvc, please use nmake instead of make.
  • Go to the top of the page

dsoodak

Beginner

Posts: 8

Location: Florida

Occupation: Instrument design, firmware, software

4

Wednesday, May 14th 2008, 3:19am

RE: QtTutorial 1- Hello World! example in Windows Vista

I am not using visual studio.

I'm not exactly sure where or what the compiler is. I'm just using whatever came with the automatic Windows installation of Qt.

This is actually the first time I've actually used a compiler that wasn't already set up as part of the source code editor. I've been trying to go through the "hello world" example in the help menu, looking things up or posting to the forum as I run into problems.
I'm not sure if this is relevant, but one of the things I had to do to get this far was to set QMAKESPEC=win32-g++.

Here are the first 30 or so lines that appeared after I typed "make" in my "Hello World" program directory:

mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Users/Dustin Soodak/Permanent 2008/Hello
World'
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\4.3.4\include\QtCore" -I"..\..\..\..\Qt\4.3.4\include\QtCore" -I"..\..
\..\..\Qt\4.3.4\include\QtGui" -I"..\..\..\..\Qt\4.3.4\include\QtGui" -I"..\..\.
.\..\Qt\4.3.4\include" -I"." -I"c:\Qt\4.3.4\include\ActiveQt" -I"debug" -I"." -I
"..\..\..\..\Qt\4.3.4\mkspecs\win32-g++" -o debug\main.o main.cpp
main.cpp:1: error: expected constructor, destructor, or type conversion before "
file"
main.cpp:1: error: expected `,' or `;' before "file"
In file included from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/cstring:49,
from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/bits/char_traits.h:45,
from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/string:47,
from ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/tool
s/qstring.h:62,
from ../../../../Qt/4.3.4/include/QtCore/qstring.h:1,
from ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/kern
el/qobject.h:50,
from ../../../../Qt/4.3.4/include/QtCore/qobject.h:1,
from ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/kern
el/qcoreapplication.h:47,
from ../../../../Qt/4.3.4/include/QtCore/qcoreapplication.h:1,
from ../../../../Qt/4.3.4/include/QtGui/../../src/gui/kernel/qa
pplication.h:47,
from ../../../../Qt/4.3.4/include/QtGui/qapplication.h:1,
from ../../../../Qt/4.3.4/include/QtGui/QApplication:1,
from main.cpp:6:
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/cstddef:52:
error: `::ptrdiff_t' has not been declared
In file included from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/iosfwd:50,
from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/bits/stl_algobase.h:70,
from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/bits/char_traits.h:46,
from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/string:47,
from ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/tool
s/qstring.h:62,
from ../../../../Qt/4.3.4/include/QtCore/qstring.h:1,
from ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/kern
el/qobject.h:50,
from ../../../../Qt/4.3.4/include/QtCore/qobject.h:1,
from ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/kern
el/qcoreapplication.h:47,
from ../../../../Qt/4.3.4/include/QtCore/qcoreapplication.h:1,
from ../../../../Qt/4.3.4/include/QtGui/../../src/gui/kernel/qa
pplication.h:47,
from ../../../../Qt/4.3.4/include/QtGui/qapplication.h:1,
from ../../../../Qt/4.3.4/include/QtGui/QApplication:1,
from main.cpp:6:
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/postype
s.h:78: error: `ptrdiff_t' does not name a type
In file included from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/bits/stl_algobase.h:73,
from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/bits/char_traits.h:46,
from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/string:47,
from ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/tool
s/qstring.h:62,
from ../../../../Qt/4.3.4/include/QtCore/qstring.h:1,
from ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/kern
el/qobject.h:50,
from ../../../../Qt/4.3.4/include/QtCore/qobject.h:1,
from ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/kern
el/qcoreapplication.h:47,
from ../../../../Qt/4.3.4/include/QtCore/qcoreapplication.h:1,
from ../../../../Qt/4.3.4/include/QtGui/../../src/gui/kernel/qa
pplication.h:47,
from ../../../../Qt/4.3.4/include/QtGui/qapplication.h:1,
from ../../../../Qt/4.3.4/include/QtGui/QApplication:1,
from main.cpp:6:
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_ite
rator_base_types.h:104: error: `ptrdiff_t' has not been declared
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_ite
rator_base_types.h:141: error: `ptrdiff_t' does not name a type
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_ite
rator_base_types.h:151: error: `ptrdiff_t' does not name a type
In file included from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/bits/char_traits.h:46,
from C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/
c++/3.4.2/string:47,
from ../../../../Qt/4.3.4/include/QtCore/../../src/corelib/tool
  • Go to the top of the page

dsoodak

Beginner

Posts: 8

Location: Florida

Occupation: Instrument design, firmware, software

5

Wednesday, May 14th 2008, 4:12am

RE: QtTutorial 1- Hello World! example in Windows Vista

Never mind. Fixed this one(typo in file).

there now only appears to be a single error.

C:\Users\Dustin Soodak\Permanent 2008\Hello World>make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Users/Dustin Soodak/Permanent 2008/Hello
World'
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\4.3.4\include\QtCore" -I"..\..\..\..\Qt\4.3.4\include\QtCore" -I"..\..
\..\..\Qt\4.3.4\include\QtGui" -I"..\..\..\..\Qt\4.3.4\include\QtGui" -I"..\..\.
.\..\Qt\4.3.4\include" -I"." -I"c:\Qt\4.3.4\include\ActiveQt" -I"debug" -I"." -I
"..\..\..\..\Qt\4.3.4\mkspecs\win32-g++" -o debug\main.o main.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -mthreads -Wl -Wl,-subsystem,windows -o "debug\Hello World.exe" debug/main.o
-L"c:\Qt\4.3.4\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot fin
d -lqtmaind
collect2: ld returned 1 exit status
mingw32-make[1]: *** ["debug\Hello] Error 1
mingw32-make[1]: Leaving directory `C:/Users/Dustin Soodak/Permanent 2008/Hello
World'
mingw32-make: *** [debug] Error 2

C:\Users\Dustin Soodak\Permanent 2008\Hello World>
  • Go to the top of the page

dsoodak

Beginner

Posts: 8

Location: Florida

Occupation: Instrument design, firmware, software

6

Wednesday, May 14th 2008, 4:24am

RE: QtTutorial 1- Hello World! example in Windows Vista

and it looks like other people have had the same problem so I'll probably be able to figure it out from here.
  • Go to the top of the page

Rate this thread