Results 1 to 5 of 5

Thread: Best/easiest way to port a MSVS-created Qt application to Linux

  1. #1
    Join Date
    Aug 2014
    Posts
    2
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Best/easiest way to port a MSVS-created Qt application to Linux

    Hello,

    We have hired an external guy (Visual Studio-user with no Linux experience whatsoever) to program an Qt application which I (Linux user with no Visual Studio experience whatsoever) now have to deploy on Linux.

    AFAIK he used Qt designer and some "official" plugin for Visual Studio, so I guess he did the Qt app the "normal" and usual way. Probably "Notepad" is the default name which he also didn't bother to change.

    The source code is organized like this, which I assume is normal for Visual Studio:

    ./Notepad.sdf
    ./Notepad
    ./Notepad/GeneratedFiles
    ./Notepad/GeneratedFiles/ui_notepad.h
    ./Notepad/GeneratedFiles/qrc_notepad.cpp
    ./Notepad/GeneratedFiles/Debug
    ./Notepad/GeneratedFiles/Debug/moc_notepad.cpp
    ./Notepad/GeneratedFiles/Release
    ./Notepad/Notepad.vcxproj
    ./Notepad/notepad.ui
    ./Notepad/notepad.cpp
    ./Notepad/notepad.h
    ./Notepad/Resources
    ./Notepad/Debug
    ./Notepad/Debug/notepad.obj
    ./Notepad/Debug/qrc_notepad.obj
    ./Notepad/Debug/Notepad.log
    ./Notepad/Debug/main.obj
    ./Notepad/Debug/Notepad.tlog
    ./Notepad/Debug/Notepad.tlog/custombuild.command.1.tlog
    ./Notepad/Debug/Notepad.tlog/link.command.1.tlog
    ./Notepad/Debug/Notepad.tlog/CL.read.1.tlog
    ./Notepad/Debug/Notepad.tlog/link.write.1.tlog
    ./Notepad/Debug/Notepad.tlog/cl.command.1.tlog
    ./Notepad/Debug/Notepad.tlog/CL.write.1.tlog
    ./Notepad/Debug/Notepad.tlog/link.read.1.tlog
    ./Notepad/Debug/Notepad.tlog/custombuild.write.1.tlog
    ./Notepad/Debug/Notepad.tlog/Notepad.lastbuildstate
    ./Notepad/Debug/Notepad.tlog/custombuild.read.1.tlog
    ./Notepad/Debug/vc120.pdb
    ./Notepad/Debug/moc_notepad.obj
    ./Notepad/main.cpp
    ./Notepad/notepad.qrc
    ./Notepad/Notepad.vcxproj.filters
    ./Notepad/Notepad.vcxproj.user
    ./Win32
    ./Win32/Debug
    ./Win32/Debug/Notepad.ilk
    ./Win32/Debug/Notepad.pdb
    ./Win32/Debug/Notepad.exe
    ./Notepad.sln
    ./Notepad.v12.suo

    no Makefile, no build-script, no nothing.

    The application does nothing special (display a GUI and read/write a file and that was it) - is there an easy way to create/get a Makefile to compile it on Linux?
    Probably I could easily adapt a Makefile from any Qt application that also uses this MSVS directory structure.

    Thanks a lot

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Best/easiest way to port a MSVS-created Qt application to Linux

    This seem to be a simple single directory application.

    If you are familiar with Qt apps on Linux, you should face no problem porting it.

    You can proceed with 2 approaches -
    1) Clean all the MSVC files.. keep only the source files. Then do
    qmake -project
    This will generate a .pro file which you can use in Qt Creator

    2) Make a new project in Qt Creator ( choose the one which is close to your app, or start with empty project)
    Keep adding the source, header, resources files to the project.

    I hope this helps

  3. The following user says thank you to aamer4yu for this useful post:

    Robbie75 (5th August 2014)

  4. #3
    Join Date
    Aug 2014
    Posts
    2
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Best/easiest way to port a MSVS-created Qt application to Linux

    Quote Originally Posted by aamer4yu View Post
    This seem to be a simple single directory application.

    If you are familiar with Qt apps on Linux, you should face no problem porting it.
    To my shame, I am (no longer) familiar with Qt apps - it has been quite a while...

    Quote Originally Posted by aamer4yu View Post
    You can proceed with 2 approaches -
    1) Clean all the MSVC files.. keep only the source files. Then do
    qmake -project
    This will generate a .pro file which you can use in Qt Creator

    2) Make a new project in Qt Creator ( choose the one which is close to your app, or start with empty project)
    Keep adding the source, header, resources files to the project.

    I hope this helps
    Unfortunately not (yet) because I need to find a solution that can be automated (i.e. developer sends us zip-file which gets unpacked and compiled automatically).

    I went to the ./Notepad directory and ran qmake -project which executed fine, then I generated a makefile by just running qmake, but when I try to build it cannot find all headers. (it cannot find qlabel.h which is in the QtWidgets subdirectory)

    qmake --help seems to know the answer:

    Qt Code:
    1. Mode:
    2. -project Put qmake into project file generation mode
    3. In this mode qmake interprets files as files to
    4. be built,
    5. defaults to *; *; *; *.ts; *.xlf; *.qrc
    6. Note: The created .pro file probably will
    7. need to be edited. For example add the QT variable to
    8. specify what modules are required.
    To copy to clipboard, switch view to plain text mode 

    I guess I need to specify the QtWidgets module.

    Naive as I am, I tried
    Qt Code:
    1. echo "QT += QtWidgets" >> Notepad.pro
    To copy to clipboard, switch view to plain text mode 
    but that only gets me:

    Qt Code:
    1. Project ERROR: Unknown module(s) in QT: QtWidgets
    To copy to clipboard, switch view to plain text mode 

    After reading:
    https://qt-project.org/wiki/Spelling..._Documentation

    I also tried it with just "Widgets" instead of "QtWidgets" but that didn't work either.


    Added after 6 minutes:


    OK, it worked with "widgets" (all lowercase), thanks a lot!
    Last edited by Robbie75; 5th August 2014 at 18:59.

  5. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Best/easiest way to port a MSVS-created Qt application to Linux

    Qt Code:
    1. (...)
    2. ./Notepad/GeneratedFiles/ui_notepad.h
    3. ./Notepad/GeneratedFiles/qrc_notepad.cpp
    4. ./Notepad/GeneratedFiles/Debug
    5. ./Notepad/GeneratedFiles/Debug/moc_notepad.cpp
    6. ./Notepad/GeneratedFiles/Release
    7. (...)
    To copy to clipboard, switch view to plain text mode 
    Ugh, he could at least do "make clean" before giving you the sources... Shame on him

  6. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Best/easiest way to port a MSVS-created Qt application to Linux

    OK, it worked with "widgets" (all lowercase), thanks a lot!
    I guess you are now compiling with Qt 5.x while ur MSVC code was with Qt 4.x

Similar Threads

  1. Replies: 1
    Last Post: 30th May 2011, 14:46
  2. how to port application made in linux to windows platform
    By sachinmcajnu in forum Qt Programming
    Replies: 8
    Last Post: 11th March 2011, 19:11
  3. How to port windows app to linux
    By sudheer168 in forum Qt Programming
    Replies: 4
    Last Post: 15th October 2009, 09:39
  4. MFC DLL port to Linux
    By steg90 in forum General Programming
    Replies: 1
    Last Post: 12th July 2007, 19:57
  5. Replies: 4
    Last Post: 12th January 2006, 05:16

Tags for this Thread

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.