February 27, 2012

kwyjibo kwyjibo
Lab Rat
4 posts

how to add png++/libpng to Qt Creator?

 

I will change the code to use QImage but first I need to run it as is (with png++)

If this can’t be done on Qt Creator any other free compiler with Qt support would be good, thanks.

Using windows Qt Creator 2.4.1

I already tried different version of libng and png++

I added this to my .pro file so it loads libraries

  1. LIBS += -L"$$PWD/lpng159/" -lpsapi
  2. LIBS += -L"$$PWD/png++/" -lpsapi

but when compiling I get errors like these:

  1. build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../xx/png++/info_base.hpp:55: undefined reference to `png_create_info_struct'
  2. debug/main.o:build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:60: undefined reference to `png_read_info'
  3. debug/main.o:build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:69: undefined reference to `png_get_IHDR'
  4. debug/main.o:build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:71: undefined reference to `png_get_valid'
  5. debug/main.o:build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:75: undefined reference to `png_get_PLTE'
  6. debug/main.o:build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:79: undefined reference to `png_get_valid'
  7. debug/main.o:build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:85: undefined reference to `png_get_tRNS'

6 replies

February 27, 2012

koahnig koahnig
Gene Splicer
2906 posts

welcome to devnet

Are you sure that there is info_base.hpp and info.hpp in the directory png++ ?

February 27, 2012

kwyjibo kwyjibo
Lab Rat
4 posts

Thank you :)
yes the file are there I extracted png++ again to test, still same problem.

February 27, 2012

koahnig koahnig
Gene Splicer
2906 posts

Do you have includepath [developer.qt.nokia.com] set?

But probably there is a problem with your relative path you are using. Is there a directory “xx” parallel to “build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug”?

February 27, 2012

kwyjibo kwyjibo
Lab Rat
4 posts

Ye, sorry I just hate to show real paths online, specially when they are absolute.

My project path is Qt\untitled, the “debug” path is located on Qt\untitled-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug

I didn’t change anything on default project, just added the 2 lines mentioned above to my project file.

Here is roughly my folder structure

  1.     untitled-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug\ <-auto generated
  2.         <auto generated files>
  3.     untitled\
  4.         untitled.pro
  5.         lpng159\
  6.             <extracted libpng files(png.c, png.h, etc)>
  7.         png++\
  8.             <extracted png++ files(png.hpp, info.hpp, info_base.hpp, etc)>

March 8, 2012

kwyjibo kwyjibo
Lab Rat
4 posts

Anyone? I don’t want to cancel the use of Qt just because their IDE can’t import a simple library

March 8, 2012

mlong mlong
Robot Herder
1551 posts
kwyjibo wrote:
Anyone? I don’t want to cancel the use of Qt just because their IDE can’t import a simple library

That’s a pretty bold statement. I wouldn’t chalk up the fact that you’re having problems as “their IDE can’t import a simple library.” Thousands of developers write millions of lines of code every day using the IDE, and I haven’t heard of library importing being a huge stumbling block. Typically it works very well.

On a more helpful track, though, do you know for sure if the $$PWD refers to your untitled/ directory at build-time? or if it refers to untitled-build-desktop-* ? (I don’t remember the semantics of it offhand.) You might try turning off shadow build in your project preferences, to see if that makes a difference.

 Signature 

Senior Software Engineer
AccuWeather Enterprise Solutions
/* My views and opinions do not necessarily reflect those of my employer.  Void where prohibited. */

 
  ‹‹ [SOLVED] Q_ASSERT doesn’t crash an application in debug run      Qt Creator 2.4.1 & cmake problems ››

You must log in to post a reply. Not a member yet? Register here!