Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. linker error in vs code
Forum Updated to NodeBB v4.3 + New Features

linker error in vs code

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
14 Posts 6 Posters 2.0k Views 2 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.
  • cristian-adamC Offline
    cristian-adamC Offline
    cristian-adam
    wrote on last edited by
    #5

    You need to either use both MinGW and Qt from Msys2 or from Qt.

    Currently you are mixing the compiler from Msys2 and Qt from the Qt SDK.

    Please do install MinGW from the Qt SDK and you should not have compatibility issues.

    But instead of using -I and -L with the Qt include and lib paths you might want to use a CMake preset with vscode. Or just use Qt Creator 😅

    K 1 Reply Last reply
    0
    • 8Observer88 Offline
      8Observer88 Offline
      8Observer8
      wrote on last edited by 8Observer8
      #6

      I use Sublime Text 4 for regular coding as it requires the least resources of my laptop. My laptop works silently with this editor. It helps me in learning Qt because there is no autocomplete in the editor. There is an autocomplete plugin for Sublime Text 4 but I don't want to use it. I use Qt Creator when I need to debug a program, or when I need to create an APK (Android executable), or when I need to debug a program on an Android emulator.

      You need to check how your application compiles from the console:

      • Add a target name to your .pro file: TARGET = app
      • Navigate to your project folder from the console and type: qmake -makefile
      • Compile your code: mingw32-make
      • Run the application: release/app

      I think you will have the same errors as above. Add these paths to the Path variable:

      C:\Qt\6.2.4\mingw_64\bin
      C:\Qt\Tools\mingw1120_64\bin

      P.S. To open a window with your Path variable, you can copy this command: rundll32 sysdm.cpl,EditEnvironmentVariables and paste it into the Far Manager console. In this case, you can very quickly open a window with your Path variable by typing run in the Far Manager console, and autocomplete will add the rest of the command, since Far Manager will save the command after the first time the command is run.

      P.S.S If you need to output something to the console with std::cout from Windows from a program that you run from the console, you need to add this code to main.cpp:

      #ifdef _WIN32
      #include <windows.h>
      #endif
      
      #include "main_window.h"
      #include <QtWidgets/QApplication>
      
      int main(int argc, char *argv[])
      {
      #ifdef _WIN32
          if (AttachConsole(ATTACH_PARENT_PROCESS))
          {
              freopen("CONOUT$", "w", stdout);
              freopen("CONOUT$", "w", stderr);
          }
      #endif
          QApplication a(argc, argv);
          MainWindow w;
          w.show();
          return a.exec();
      }
      
      1 Reply Last reply
      0
      • cristian-adamC cristian-adam

        You need to either use both MinGW and Qt from Msys2 or from Qt.

        Currently you are mixing the compiler from Msys2 and Qt from the Qt SDK.

        Please do install MinGW from the Qt SDK and you should not have compatibility issues.

        But instead of using -I and -L with the Qt include and lib paths you might want to use a CMake preset with vscode. Or just use Qt Creator 😅

        K Offline
        K Offline
        kamran78nasirizad
        wrote on last edited by
        #7

        @cristian-adam
        how I must install minGW from QT SDK and how I must use CMake preset in vs-code?
        my Qt Creator free trial is finished and I no longer have access to it and as I know it is not free any more

        jsulmJ 1 Reply Last reply
        0
        • K kamran78nasirizad

          @cristian-adam
          how I must install minGW from QT SDK and how I must use CMake preset in vs-code?
          my Qt Creator free trial is finished and I no longer have access to it and as I know it is not free any more

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #8

          @kamran78nasirizad said in linker error in vs code:

          Qt Creator free trial

          QtCreator is open source and free to use for everyone.
          To install MinGW simply use Qt Maintenance Tool from your Qt installation.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          K 1 Reply Last reply
          1
          • jsulmJ jsulm

            @kamran78nasirizad said in linker error in vs code:

            Qt Creator free trial

            QtCreator is open source and free to use for everyone.
            To install MinGW simply use Qt Maintenance Tool from your Qt installation.

            K Offline
            K Offline
            kamran78nasirizad
            wrote on last edited by
            #9

            @jsulm when I open the Qt creator this message shown.
            and if I click on close the entire program would close

            Capture.PNG

            JonBJ jsulmJ 2 Replies Last reply
            0
            • K kamran78nasirizad

              @jsulm when I open the Qt creator this message shown.
              and if I click on close the entire program would close

              Capture.PNG

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #10

              @kamran78nasirizad
              I think you need to explain exactly what/how you installed Qt. Also had you installed any other version of Qt on that machine at an earlier date?

              K 1 Reply Last reply
              0
              • K kamran78nasirizad

                @jsulm when I open the Qt creator this message shown.
                and if I click on close the entire program would close

                Capture.PNG

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #11

                @kamran78nasirizad Please explain how you installed QtCreator...

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kamran78nasirizad
                  wrote on last edited by
                  #12

                  I went to the Qt.io website, and clicked on the "Download. Try." button, then in "https://www.qt.io/download" I clicked on "Download Qt for Windows", and after completing the form and downloading the Qt installer ran it.

                  Is this the wrong method to download and install Qt and Qt Creator?

                  jsulmJ 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @kamran78nasirizad
                    I think you need to explain exactly what/how you installed Qt. Also had you installed any other version of Qt on that machine at an earlier date?

                    K Offline
                    K Offline
                    kamran78nasirizad
                    wrote on last edited by
                    #13

                    @JonB No the system was fresh before installing this Qt.

                    1 Reply Last reply
                    0
                    • K kamran78nasirizad

                      I went to the Qt.io website, and clicked on the "Download. Try." button, then in "https://www.qt.io/download" I clicked on "Download Qt for Windows", and after completing the form and downloading the Qt installer ran it.

                      Is this the wrong method to download and install Qt and Qt Creator?

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #14

                      @kamran78nasirizad said in linker error in vs code:

                      Is this the wrong method to download and install Qt and Qt Creator?

                      You should go to https://www.qt.io/download-open-source and download the installer from there.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      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