Results 1 to 9 of 9

Thread: Jpeg support or ordeal is on the go

  1. #1
    Join Date
    Apr 2010
    Location
    Moscow
    Posts
    31
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Jpeg support or ordeal is on the go

    Hi there. I know that this topic has been brought up dozen of times, but I am still having trouble. I need to distribute my application to another computer. And I want to have JPEG support.

    here .pro file:

    Qt Code:
    1. CONFIG += static
    2. TARGET = QKml
    3. QTPLUGIN+= qjpeg
    4. TEMPLATE = app
    5. SOURCES += main.cpp \
    6. mainwindow.cpp \
    7. kml.cpp \
    8. Geodesic.cpp \
    9. JPG.cpp
    10. HEADERS += mainwindow.h \
    11. kml.h \
    12. Geodesic.hpp \
    13. Constants.hpp \
    14. JPG.h
    15. FORMS += mainwindow.ui
    To copy to clipboard, switch view to plain text mode 

    Here my main.cpp file:
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "mainwindow.h"
    3.  
    4. #include <QtPlugin>
    5.  
    6. Q_IMPORT_PLUGIN(qjpeg)
    7.  
    8. int main(int argc, char *argv[])
    9. {
    10. QTextCodec::setCodecForCStrings(QTextCodec::codecForName("Windows-1251"));
    11.  
    12. QStringList list_path;
    13. QDir dir = QDir(qApp->applicationDirPath()+"/plugins/");
    14. list_path << dir.absolutePath () << qApp->libraryPaths ();
    15. qApp->setLibraryPaths( list_path );
    16.  
    17. QApplication a(argc, argv);
    18. a.setLibraryPaths(list_path);
    19. MainWindow w;
    20. w.show();
    21. return a.exec();
    22. }
    To copy to clipboard, switch view to plain text mode 
    I'm trying to compile it as "release".
    And it doesn't want to be compiled. The error is: "collect2: ld returned 1 exit status". In release folder where .exe is located I have "imageformats" folder with dlls and ".a" files. Can somebody help? Thank you so much in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Jpeg support or ordeal is on the go

    Forget about all your plugin stuff. Simply build the plugin and put the dll along side your application when shipping it. Qt will find the plugin by itself.

  3. #3
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Thanks
    2
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Jpeg support or ordeal is on the go

    By the way, do not use qApp macro before creating an instance: QApplication a(argc, argv);

  4. #4
    Join Date
    Apr 2010
    Location
    Moscow
    Posts
    31
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Jpeg support or ordeal is on the go

    Ok, I will not use "plugin stuff" and qApp macro, whatever it means, but can you be more specific about how? What do you mean by simply build my plugin? I don't use my own I just need "jpeg" to function in my application. Have I got to just put qjpeg4.dll in folder where .exe is located? (I tried and to no avail). What am I to do to make that work? Any workable example will be of help.

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Jpeg support or ordeal is on the go

    have a look at the documentation on how to deploy an application. On the bottom you find how to deal with Qt plugins. For building the jpeg plugin also look at the documentation. There is a howto. Just go in the source tree of Qt to the jpeg directory and build the plugin.

    If the documentation is not enough for you, search the forum. There are a lot of topics about your problem.

  6. #6
    Join Date
    Apr 2010
    Location
    Moscow
    Posts
    31
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Jpeg support or ordeal is on the go

    Thank you. So, as far as I understand, there is no need in manipulating with Q_IMPORT or whatever. So I will try placing "imageformats" folder in my .exe folder tommorow with dll's inside. Should it contain "a" files? You mentioned a lot of topics, but I haven't stumbled across a single one which can give a tangible answer as to the error I keep receiving. And, frankly, I don't understand what it means to "compile statically". Do I have to rebuild QT with another compiling parameters?

  7. #7
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Jpeg support or ordeal is on the go

    Try it and see if it works. The error just indicates, that a library could not be found. But without more information one can't tell more.

  8. The following user says thank you to Lykurg for this useful post:

    Astrologer (27th April 2010)

  9. #8
    Join Date
    Apr 2010
    Location
    Moscow
    Posts
    31
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Jpeg support or ordeal is on the go

    It worked. I put "imageformats" folder into folder with executable and used release compilation. Thank you all, guys!

  10. #9
    Join Date
    Apr 2010
    Posts
    37
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Jpeg support or ordeal is on the go

    Simply create a subdirectory in the same directory as your application. In the subdirectory, include qjpeg4.dll

Similar Threads

  1. QtCreator, QPixmap & jpeg support
    By NinoUzi in forum Newbie
    Replies: 8
    Last Post: 27th June 2009, 19:38
  2. Jpeg/Gif/Tiff support in -shared
    By gimel in forum Installation and Deployment
    Replies: 3
    Last Post: 27th December 2008, 17:39
  3. Qt static library with jpeg support
    By vishal.chauhan in forum Installation and Deployment
    Replies: 2
    Last Post: 11th May 2007, 06:53
  4. Strange Problem with JPEG Support on win XP
    By caligula in forum Installation and Deployment
    Replies: 3
    Last Post: 18th September 2006, 10:36
  5. Jpeg not support~
    By denny.t in forum Qt Programming
    Replies: 4
    Last Post: 31st March 2006, 09:29

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
  •  
Qt is a trademark of The Qt Company.