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. QtCreator vs cmd.exe (not equal)
Forum Updated to NodeBB v4.3 + New Features

QtCreator vs cmd.exe (not equal)

Scheduled Pinned Locked Moved General and Desktop
15 Posts 3 Posters 4.6k Views 3 Watching
  • 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.
  • sneubertS Offline
    sneubertS Offline
    sneubert
    wrote on last edited by
    #2

    Hi,

    best way in Qt Creator for your case is probably to start from a "Project without Qt" -> "C++ Project". (maybe the names are slightly diffrent, I´m only guessing because my installation is german)

    Qt Creator will ask you for the kit, you want to use. To narrow where the errors come from, check that you configure for the kit containing the mingw4.9 compiler. If you don´t have a kit, create a new one.

    Copy the .c, .cpp and .a files to the project directory and edit your .pro file:

    TEMPLATE = app
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG -= qt
    
    SOURCES += file1.c \
               file2.c \
               file3.cpp
    
    HEADERS += youSureHaveSomeHeader.h \
               andMaybeOneMore.h
    
    LIBS +=  -llibUSTROYSTVO
    
    include(deployment.pri)
    qtcAddDeployment()
    

    Before compiling, you now need to run qmake!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JustOneQuestion
      wrote on last edited by SGaist
      #3

      Thank you, sneubert, for your advices.
      I am not sure that I have done exactly what you said, so I describe what I do.
      I choose C++ Project, With qmake, without Qt. There are 2 “similar” types: 1) C++ Project, With cmake, without Qt; 2) C++ Project, With qbs, without Qt. I suppose you mean “With qmake” isn’t?

      “… check that you configure for the kit containing the mingw4.9 compiler. If you don´t have a kit, create a new one.”
      Unfortunatly I don’t know how to check “mingw4.9 compiler”. I use default kit “KitSelection:Desktop Qt 5.4.1 MinGW 32bit”. And maybe, this parameter from Project Prpoperties can be interesting too
      qmake.exe ProjectTestNoQt.pro -r -spec win32-g++

      File *.pro have a bit difference
      LIBS += -L$$PWD/ -lUSTROYSTVO //not llibUSTROYSTVO and with pwd

      INCLUDEPATH += $$PWD/ // and this 2 strings(1)
      DEPENDPATH += $$PWD/ // and this 2 strings(2)

      And these strings was placed before "headers +=.. ". But I moved them to the end of file.
      include(deployment.pri)
      qtcAddDeployment()

      But however I have the same errors like I had early.
      Any ideas? )) I asked in third forum and still can’t solve my problem. (( So I am glad to see any your advice and idea.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Hi and welcome to devnet,

        What errors are you getting now ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JustOneQuestion
          wrote on last edited by
          #5

          Thank you, SGaist , for your or attention.

          I have some identical errors in different parts of code: “undefined reference to” and “more undefined references to”
          For example:

          undefined reference to SomeOneFunc(_dictionary_*, char const*, int)' . more undefined references to SomeOneOtherFunc(dictionary, char const, int)' follow.

          This SomeOneFuncs are described in file1.c and file1.h and they have no deal with *.a. (I am not totally sure but looks like that is true. As I said before I am not author of this code.)
          Moreover there is exist one more error (last one)
          C:/ProgramFiles/QtMinGW/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: release/ FileMain.o: bad reloc address 0x14 in section `.text$ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_ERKS6_S8[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_ERKS6_S8]'
          collect2.exe: error: ld returned 1 exit status
          mingw32-make[1]: *** [release\ProjectTest.exe] Error 1
          mingw32-make: *** [release] Error 2

          1 Reply Last reply
          0
          • sneubertS Offline
            sneubertS Offline
            sneubert
            wrote on last edited by
            #6

            The bad reloc address error you get, maybe caused by linking files compiled with different compilers.
            Do you build any part with a different compiler, or different version of gcc?
            Sometimes such errors are the result of having multiple mingw installation.
            You can compile from command line. Can you check the gcc dir with where g++?

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JustOneQuestion
              wrote on last edited by
              #7

              When I compile from command line I use shortcut “Qt 5.4 for Desktop (MinGW 4.9 32 bit)” (from Start->Programs->Qt MinGW). This shortcut has properties (target object.. don’t sure how to translate it correct. But I suppose you know what I mean. ) This is one row
              C:\Windows\System32\cmd.exe /A /Q /K C:\ProgramFiles\QtMinGW\5.4\mingw491_32\bin\qtenv2.bat

              As I understand /A /Q /K is not important for compiler options. This is tenv2.bat file text: (4 rows)

              echo off
              echo Setting up environment for Qt usage...
              set PATH=C:\ProgramFiles\QtMinGW\5.4\mingw491_32\bin;C:\ProgramFiles\QtMinGW\Tools\mingw491_32\bin;%PATH%
              cd /D C:\ProgramFiles\QtMinGW\5.4\mingw491_32

              I don’t know how to check what QtCreator uses… Could you help me to know it?

              Moreover…When I saw first time Qt example I had OS Windows 8.1 and MS Visual Studio 2010 and I didn’t know what does g++ means. So I downloaded and installed Qt (5.4.1 MSVC 2010, 32bit) (qt-opensource-windows-x86-1.6.0-8-online, http://www.qt.io/download-open-source/). :) A bit later I had understood that it isn’t what I need :). After that I downloaded and installed http://sourceforge.net/projects/mingw/files/Installer/ mingw-get-setup.exe (86.5 kB) [with Basic Setup mingw-developer-tolkit mingw32-base mingw32-gcc-g++ msys-base]
              And the example works well with Windows cmd.exe without any bat-files or something else. But of course I set path to environment. After this I downloaded and installed Qt 5.4.1 for Windows 32-bit (MinGW 4.9.1, 856 MB) ( www.qt.io/download-open-source/ ). "G++..." command still works good from cmd.exe and g++ from previous installated MinGW (mingw-get-setup.exe).
              But I tried to delete path from environment for installed MinGW (mingw-get-setup.exe) and g++ stopped work with Windows cmd.exe But g++ command works with shortcut “Qt 5.4 for Desktop (MinGW 4.9 32 bit)”.
              Note: When I say “Windows cmd.exe ” I mean Start->Run->cmd.exe. Not shortcut with bat file and “path=…”. Moreover I don’t see in environment paths any folder for installed Qt 5.4.1 for Windows 32-bit (MinGW 4.9.1, 856 MB).
              I didn’t build compile etc *.a library from this example. And I haven't got source code for it or any information about how it had been created too.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                There's absolutely no need to install anything from MinGW since it comes as an option when you use the installer. Use that one. If you really want to do console development on Windows, then use the provided link to setup the console. Otherwise you'll have to do it by hand. Don't modify the PATH environment variable by hand, that's the shortest way to a world of trouble.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                J 1 Reply Last reply
                0
                • SGaistS SGaist

                  There's absolutely no need to install anything from MinGW since it comes as an option when you use the installer. Use that one. If you really want to do console development on Windows, then use the provided link to setup the console. Otherwise you'll have to do it by hand. Don't modify the PATH environment variable by hand, that's the shortest way to a world of trouble.

                  J Offline
                  J Offline
                  JustOneQuestion
                  wrote on last edited by
                  #9

                  @SGaist said:

                  There's absolutely no need to install anything from MinGW since it comes as an option when you use the installer. Use that one. If you really want to do console development on Windows, then use the provided link to setup the console. Otherwise you'll have to do it by hand. Don't modify the PATH environment variable by hand, that's the shortest way to a world of trouble.

                  Ок. Thank you for advice. I understand. But what should I do now for create QtCreator project without errors? Should I uninstall all Qt and MinGW and reinstall then only Qt (MinGW version)?

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    Since your install looks a bit messed up, yes, stat from clean

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      JustOneQuestion
                      wrote on last edited by
                      #11

                      I have cleaned and reinstalled Qt. Moreover I installed Qt(MinGW) on other PC (without qt mingw etc before, but with MS VS2010).
                      In both case there are the same errors I have described.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        The bad realloc error ? Or the kit error ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • J Offline
                          J Offline
                          JustOneQuestion
                          wrote on last edited by JustOneQuestion
                          #13

                          @SGaist said:

                          The bad realloc error ? Or the kit error ?

                          Yes, realloc and undefined reference.
                          undefined reference to SomeOneFunc(dictionary, char const, int)' .
                          more undefined references to SomeOneOtherFunc(dictionary, char const, int)' follow.
                          and
                          ...bad reloc address 0x14 in section...
                          I said about it before. Nothing changed after reinstall. And I have the same errors on other PC too.

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            What symbols are missing ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0
                            • J Offline
                              J Offline
                              JustOneQuestion
                              wrote on last edited by
                              #15

                              Thanks for advices.
                              I have found the solve at Russian Qt forum.
                              http://www.forum.crossplatform.ru/index.php?showtopic=10432
                              Thanks to them.
                              Problem can be solved by renaming all *.c file in project into *.cpp file.

                              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