December 5, 2010

benardmens benardmens
Lab Rat
13 posts

Issues compiling c files in Qt creator

Page  
1

I’m learning c/c++ and wanted to do some work with QT Creator. I am using a base64 class that just refuses to compile and any help would be greatly appreciated.

The error lines I get is
/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.h:59: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’

/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.h:66: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’

/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.c:68: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’

/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.c:: error: At top level:

/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.c:320: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token

/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.c:373: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’
/QTDev/PolicyFrameworkDesktop-build-desktop/../PolicyFrameworkDesktop/libhaggle/base64.c:456: error: expected ‘;’, ‘,’ or ‘)’ before ‘in’

The files in question are in the links below along with the ‘pro’ file and the generated Makefile.

http://rapidshare.com/files/435084121/base64.c
http://rapidshare.com/files/435084122/base64.h
http://rapidshare.com/files/435084571/Makefile
http://rapidshare.com/files/435084682/PolicyFrameworkDesktop.pro

fixed topic, Tobias Hunger

27 replies

December 5, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

restrict is C keyword, not C++. I think you should not include them in .pro but make additional Makefile (manually) which will call C compiler for base64 library and link it in your .pro file.

December 5, 2010

benardmens benardmens
Lab Rat
13 posts

Hi Denis,

Thanks for the quick reply. Can you please give me an example of how to link a manual makefile to a pro file? Also i thought the #ifdef __cplusplus section would stop any compiler issues?

Thanks again

December 5, 2010

Tobias Hunger Tobias Hunger
Mad Scientist
3149 posts

Why a base64 library? Qt can de/encode base64 all by itself (QByteArray::fromBase64 and toBase64).

December 5, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

You can add it as custom target to PRE_TARGETDEPS variable I think.

December 5, 2010

benardmens benardmens
Lab Rat
13 posts
Tobias Hunger wrote:
Why a base64 library? Qt can de/encode base64 all by itself (QByteArray::fromBase64 and toBase64).

Hi Toby,
Thanks for the reply, that class is part of the source of a library that I am trying to use. It builds fine when running a normal gcc session from the command line so I was a bit surprised when I run into the issue. I’m not a c++ expert by any stretch ,just learning as I go along, but if I understand what you are suggesting it means that I have to go through the whole library replacing the instances of base64 calls with the QByteArray calls, and I don’t know how that will affect the rest of the library which was why I wanted to see if there was something I should be doing instead.

Thanks again

December 5, 2010

benardmens benardmens
Lab Rat
13 posts
Denis Kormalev wrote:
You can add it as custom target to PRE_TARGETDEPS variable I think.

Thanks for that Denis, will try that right away and let you know how it goes.

December 5, 2010

Tobias Hunger Tobias Hunger
Mad Scientist
3149 posts

benardmens: Oh, if this is part of 3rd party code then forget my comment.

Many people seem to not know that Qt can de/encode base64 all by itself… I have seen more than one piece of code where some developer dragged in a 3rd party library just to write some bytes in base64 encoding.

December 5, 2010

Volker Volker
Robot Herder
5428 posts

Unfortunately I cannot download the files (too many downloads in parallel). So, sorry, can’t help with this.

December 6, 2010

benardmens benardmens
Lab Rat
13 posts
Denis Kormalev wrote:
You can add it as custom target to PRE_TARGETDEPS variable I think.

Hi Denis, tried that but it didn’t work. The way I understood it is to add a custom Makefile argument to the PRE_TARGETDEPS? Thanks

edit: quoe fixed / Denis Kormalev

December 6, 2010

benardmens benardmens
Lab Rat
13 posts
Volker wrote:
Unfortunately I cannot download the files (too many downloads in parallel). So, sorry, can’t help with this.

Hi Volker,
These are some new links which shouldnt give the same problem,

http://www.mediafire.com/?z13ki4t48iqs8ke
http://www.mediafire.com/?nq14e8527bj4l7i
http://www.mediafire.com/?1a23rh9ngxpe3dm

I would appreciate any help as I’ve been trying to get this working for a day now. Thanks again

December 6, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

benardmens, can you show your .pro file (please post its content here in @ tags)?

December 6, 2010

xsacha xsacha
Lab Rat
517 posts

You could put the files inside a zip or tar. Makes it easier to upload and download (for future reference).

Theres a site called wikiupload that doesn’t have a time delay to download.

 Signature 

- Sacha

December 6, 2010

benardmens benardmens
Lab Rat
13 posts
Denis Kormalev wrote:
benardmens, can you show your .pro file (please post its content here in (at) tags)?

Hi Denis,
I just got a work around to work by building it as a library and adding it manually to the libs. However , i would still like to be able to understand how to do it properly if possible.

The current .pro file is below as requested

  1. #-------------------------------------------------
  2. #
  3. # Project created by QtCreator 2010-12-05T20:36:45
  4. #
  5. #-------------------------------------------------
  6.  
  7. QT       += core gui
  8.  
  9. TARGET = PolicyFrameworkSpy
  10. TEMPLATE = app
  11.  
  12. unix:LIBS +=-L/usr/include/libxml2 \
  13.             /usr/local/lib/libhaggle.a
  14.  
  15. unix:INCLUDEPATH +=/usr/local/include/libhaggle/ \
  16.                 /usr/include/libxml2 \
  17.  
  18. QMAKE_CFLAGS_DEBUG += -std=gnu99 -O2
  19. QMAKE_LFLAGS += -lxml2 -lz -lpthread -licucore -lm
  20. SOURCES += main.cpp\
  21.         PolicyFramework.cpp
  22.  
  23. HEADERS  += PolicyFramework.h
  24.  
  25. FORMS    += PolicyFramework.ui

And the one I was having issues with

  1. #-------------------------------------------------
  2. #
  3. # Project created by QtCreator 2010-12-05T16:43:38
  4. #
  5. #-------------------------------------------------
  6.  
  7. QT       += core gui
  8.  
  9. TARGET = PolicyFrameworkDesktop
  10. TEMPLATE = app
  11.  
  12. INCLUDEPATH +=/QTDev/PolicyFrameworkDesktop/libhaggle
  13.  
  14. SOURCES += main.cpp\
  15.         PolicyFrameworkSpy.cpp \
  16.     libhaggle/base64.c
  17.  
  18. HEADERS  += PolicyFrameworkSpy.h \
  19.     libhaggle/base64.h
  20.  
  21. FORMS    += PolicyFrameworkSpy.ui

December 6, 2010

benardmens benardmens
Lab Rat
13 posts

xsacha wrote:
You could put the files inside a zip or tar. Makes it easier to upload and download (for future reference).

Theres a site called wikiupload that doesn’t have a time delay to download.

Thanks for that, I will keep that in mind for later. Thanks for the help everyone. This is one of the most responsive forums I’ve ever been on!

December 6, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

benardmens, try to add something like this

  1. someLib.target = someLibBuild
  2. someLib.commands = cd path/to/lib && make
  3. QMAKE_EXTRA_TARGETS += someLib
  4. PRE_TARGETDEPS += someLibBuild

Page  
1

  ‹‹ QT Simulator under Windows 7 64bit does not work (does not exist?)      [solved][Mac OS X] Additional plugins for Qt (qca plugins) ››

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