Results 1 to 4 of 4

Thread: Problem when compiling project with visual studio

  1. #1
    Join Date
    Apr 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy Problem when compiling project with visual studio

    Hi everyone, this is my first post here.
    I'm having problems with visual studio and Qt4, y made a simple project, following a tutorial from the net. It thows QMetaObject related errors. That's fine, I have to use qmake and not the vs ide directly because of moc.
    So, I do this on the project directory:
    Qt Code:
    1. qmake -project
    2. qmake
    To copy to clipboard, switch view to plain text mode 
    Everything ok so far, but... if I then run nmake, the compiler says it can't find g++, of course... I'm not using MinGW!.

    This is the makefile generated:
    ################################################## ###########################
    # Makefile for building: QTest
    # Generated by qmake (2.01a) (Qt 4.2.3) on: mar 17. abr 12:22:23 2007
    # Project: QTest.pro
    # Template: app
    ################################################## ###########################

    ####### Compiler, tools and options

    CC = gcc
    CXX = g++
    LEX = flex
    YACC = byacc
    DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
    CFLAGS = -O2 -O2 -Wall $(DEFINES)
    CXXFLAGS = -O2 -O2 -frtti -fexceptions -Wall $(DEFINES)
    LEXFLAGS =
    YACCFLAGS = -d
    INCPATH = -I"G:/Qt/4.2.3/include/QtCore" -I"G:/Qt/4.2.3/include/QtCore" -I"G:/Qt/4.2.3/include/QtGui" -I"G:/Qt/4.2.3/include/QtGui" -I"G:/Qt/4.2.3/include" -I"." -I"G:/Qt/4.2.3/include/ActiveQt" -I"release" -I"." -I"..\..\..\Qt\4.2.3\mkspecs\default"
    LINK = g++
    LFLAGS = -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows
    LIBS = -L"g:\Qt\4.2.3\lib" -lmingw32 -lqtmain -lQtGui4 -lQtCore4
    QMAKE = qmake
    IDC = g:\Qt\4.2.3\bin\idc.exe
    IDL = midl
    ZIP = zip -r -9
    DEF_FILE =
    RES_FILE =
    COPY = copy /y
    COPY_FILE = $(COPY)
    COPY_DIR = xcopy /s /q /y /i
    DEL_FILE = del
    DEL_DIR = rmdir
    MOVE = move
    CHK_DIR_EXISTS= if not exist
    MKDIR = mkdir
    INSTALL_FILE = $(COPY_FILE)
    INSTALL_PROGRAM = $(COPY_FILE)
    INSTALL_DIR = $(COPY_DIR)

    ####### Output directory

    OBJECTS_DIR = release

    ####### Files

    SOURCES = findDialog.cpp \
    QTest.cpp \
    stdafx.cpp release\moc_findDialog.cpp
    OBJECTS = release\findDialog.o \
    release\QTest.o \
    release\stdafx.o \
    release\moc_findDialog.o
    DIST =
    QMAKE_TARGET = QTest
    DESTDIR = release\ #avoid trailing-slash linebreak
    TARGET = QTest.exe
    DESTDIR_TARGET = release\QTest.exe

    ####### Implicit rules

    .SUFFIXES: .cpp .cc .cxx .c

    .cpp.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

    .cc.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

    .cxx.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

    .c.o:
    $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<

    ####### Build rules

    first: all
    all: Makefile.Release $(DESTDIR_TARGET)

    $(DESTDIR_TARGET): $(OBJECTS)
    $(LINK) $(LFLAGS) -o "$(DESTDIR_TARGET)" $(OBJECTS) $(LIBS)


    qmake: FORCE
    @$(QMAKE) -win32 -o Makefile.Release QTest.pro

    dist:
    $(ZIP) QTest.zip $(SOURCES) $(DIST) QTest.pro G:/Qt/4.2.3/mkspecs/qconfig.pri ..\..\..\Qt\4.2.3\mkspecs\features\qt_functions.pr f ..\..\..\Qt\4.2.3\mkspecs\features\qt_config.prf ..\..\..\Qt\4.2.3\mkspecs\features\exclusive_build s.prf ..\..\..\Qt\4.2.3\mkspecs\features\default_pre.prf ..\..\..\Qt\4.2.3\mkspecs\features\win32\default_p re.prf ..\..\..\Qt\4.2.3\mkspecs\features\release.prf ..\..\..\Qt\4.2.3\mkspecs\features\debug_and_relea se.prf ..\..\..\Qt\4.2.3\mkspecs\features\default_post.pr f ..\..\..\Qt\4.2.3\mkspecs\features\build_pass.prf ..\..\..\Qt\4.2.3\mkspecs\features\Release.prf ..\..\..\Qt\4.2.3\mkspecs\features\win32\rtti.prf ..\..\..\Qt\4.2.3\mkspecs\features\win32\exception s.prf ..\..\..\Qt\4.2.3\mkspecs\features\win32\stl.prf ..\..\..\Qt\4.2.3\mkspecs\features\shared.prf ..\..\..\Qt\4.2.3\mkspecs\features\warn_on.prf ..\..\..\Qt\4.2.3\mkspecs\features\qt.prf ..\..\..\Qt\4.2.3\mkspecs\features\win32\thread.pr f ..\..\..\Qt\4.2.3\mkspecs\features\moc.prf ..\..\..\Qt\4.2.3\mkspecs\features\win32\windows.p rf ..\..\..\Qt\4.2.3\mkspecs\features\resources.prf ..\..\..\Qt\4.2.3\mkspecs\features\uic.prf g:\Qt\4.2.3\lib\qtmain.prl HEADERS RESOURCES IMAGES SOURCES FORMS

    clean: compiler_clean
    -$(DEL_FILE) release\findDialog.o release\QTest.o release\stdafx.o release\moc_findDialog.o

    distclean: clean
    -$(DEL_FILE) "$(DESTDIR_TARGET)"
    -$(DEL_FILE) Makefile.Release

    mocclean: compiler_moc_header_clean compiler_moc_source_clean

    mocables: compiler_moc_header_make_all compiler_moc_source_make_all

    compiler_moc_header_make_all: release\moc_findDialog.cpp
    compiler_moc_header_clean:
    -$(DEL_FILE) release\moc_findDialog.cpp
    release\moc_findDialog.cpp: stdafx.h \
    findDialog.h
    g:\Qt\4.2.3\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 findDialog.h -o release\moc_findDialog.cpp

    compiler_rcc_make_all:
    compiler_rcc_clean:
    compiler_image_collection_make_all: qmake_image_collection.cpp
    compiler_image_collection_clean:
    -$(DEL_FILE) qmake_image_collection.cpp
    compiler_moc_source_make_all:
    compiler_moc_source_clean:
    compiler_uic_make_all:
    compiler_uic_clean:
    compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_image_collection_clean compiler_moc_source_clean compiler_uic_clean



    ####### Compile

    release\findDialog.o: findDialog.cpp stdafx.h \
    findDialog.h
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\findDialog.o findDialog.cpp

    release\QTest.o: QTest.cpp stdafx.h \
    QTest.h \
    resource.h \
    findDialog.h
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\QTest.o QTest.cpp

    release\stdafx.o: stdafx.cpp stdafx.h
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\stdafx.o stdafx.cpp

    release\moc_findDialog.o: release\moc_findDialog.cpp
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\moc_findDialog.o release\moc_findDialog.cpp

    ####### Install

    install: FORCE

    uninstall: FORCE

    FORCE:
    Has you can see in the first lines... is not for vc++. So, my question is, how do I compile the project using vc++?

    Thanks

  2. #2
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem when compiling project with visual studio

    Can you please provide some more information?

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem when compiling project with visual studio

    use this:
    qmake -o Makefile -spec win32-msvc.net
    instead of just qmake.

    Regards

  4. #4
    Join Date
    Apr 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile Re: Problem when compiling project with visual studio

    Thanks, is working now

Similar Threads

  1. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  2. Qt 4 and Visual Studio 2005 Add-in project
    By JSPoly in forum Qt Programming
    Replies: 10
    Last Post: 23rd January 2007, 22:33
  3. Compiling?
    By Afflicted.d2 in forum Newbie
    Replies: 7
    Last Post: 16th October 2006, 19:32
  4. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 21:41
  5. Qt Designer & Visual Studio 2005
    By pSiCho in forum Qt Tools
    Replies: 6
    Last Post: 9th February 2006, 13:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.