Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [BUG] QtCreator choked with errors when compiling using QSettings
QtWS25 Last Chance

[BUG] QtCreator choked with errors when compiling using QSettings

Scheduled Pinned Locked Moved Solved General and Desktop
qtcreatorqsettingsbug
3 Posts 3 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alogim
    wrote on last edited by alogim
    #1

    I just started studying how QSettings works (in order to migrate from boost::program_options).
    However, I noticed what I assume is a bug.

    Simply copying this

      int margin = settings.value("editor/wrapMargin", 80).toInt();
    

    into a simple applications works fine. In particular, my application is the following:

    #include <QCoreApplication>
    #include <QDebug>
    #include <QSettings>
    
    int main(int argc, char *argv[])
    {
    	QCoreApplication a(argc, argv);
    
    	QSettings settings("settings.conf", QSettings::NativeFormat);
    	unsigned int sText = settings.value("MAP/WIDTH", 200).toUInt();
    	qDebug() << sText;
    
    	return a.exec();
    }
    

    with an existing and settings.conf. As soon as I add even only a space or a new void line, of course this needs to be recompiled. And as soon this gets recompiled, about 70 thousand errors appear. Only if I manually delete all executables before compiling it does work without complaining.
    These are some of the errors shown:

    12:44:30: Configuration unchanged, skipping qmake step.
    12:44:30: Starting: "/usr/bin/make" 
    g++ -c -pipe -g -std=c++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_CORE_LIB -I../../QSettings -I. -isystem /usr/include/qt -isystem /usr/include/qt/QtCore -I. -I/usr/lib/qt/mkspecs/linux-g++ -o main.o ../main.cpp
    In file included from ../main.cpp:3:0:
    ./QSettings:1:1: error: stray '\177' in program
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
     ^
    ./QSettings:1:1: error: stray '\2' in program
    ./QSettings:1:1: error: stray '\1' in program
    ./QSettings:1:1: error: stray '\1' in program
    ./QSettings:1:8: warning: null character(s) ignored
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
            ^
    ./QSettings:1:1: error: stray '\2' in program
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
     ^
    ./QSettings:1:18: warning: null character(s) ignored
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
                      ^
    ./QSettings:1:20: warning: null character(s) ignored
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
                        ^
    ./QSettings:1:1: error: stray '\1' in program
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
     ^
    ./QSettings:1:22: warning: null character(s) ignored
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
                          ^
    ./QSettings:1:27: error: stray '@' in program
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
                               ^
    ./QSettings:1:28: warning: null character(s) ignored
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
                                ^
    ./QSettings:1:33: error: stray '@' in program
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
                                     ^
    ./QSettings:1:34: warning: null character(s) ignored
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
                                      ^
    ./QSettings:1:1: error: stray '\20' in program
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
     ^
    ./QSettings:1:1: error: stray '\26' in program
    ./QSettings:1:1: error: stray '\4' in program
    ./QSettings:1:44: warning: null character(s) ignored
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
                                                ^
    ./QSettings:1:53: error: stray '@' in program
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
                                                         ^
    ./QSettings:1:54: warning: null character(s) ignored
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
                                                          ^
    ./QSettings:1:56: warning: null character(s) ignored
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
                                                            ^
    ./QSettings:1:1: error: stray '\10' in program
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
     ^
    ./QSettings:1:58: warning: null character(s) ignored
     ELF          >     @     @                @ 8  @ % "       @       @ @     @ @     �      �                           @      @                                          @       @     u      u                    x      x`     x`                               �      �`     �`                                      @     @     D       D              P�td   (      (@     (@     �       �              Q�td                                                  /lib64/ld-linux-x86-64.so.2          GNU                        GNU ����}����^�t��A�            ��  @          BE�����|����qX���yIk�                            h                     �                      Q                     p                      q                     �                      y                     �                     @                     �                      �                                          �                     V                       �                     �                                              X                     x                                                                  <                       �    �`             �    �`             j     �
    

    Even by selecting clean the executable QSettings doesn't get deleted, and that seems to be the one responsible for all these errors. If I delete it, I can compile the program without errors. Any reasons for this?
    I'm on Arch, kernel 4.1.16-1-lts using Qt Creator 3.6.0 based on Qt 5.5.1 (GCC 5.3.0, 64 bit).

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, because your application is also called QSettings, the #include <QSettings> gets confused and instead of including Qt's file, it ends up trying to compile your .exe file.

      So either change to #include <qsettings.h> or rename your app to something else...

      1 Reply Last reply
      4
      • T Offline
        T Offline
        thacngoc
        wrote on last edited by
        #3

        thanks for your anwser

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved