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. [Solved] undefined reference to `RasDialDlgW@16'
Forum Updated to NodeBB v4.3 + New Features

[Solved] undefined reference to `RasDialDlgW@16'

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 1.6k 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.
  • M Offline
    M Offline
    MrOplus
    wrote on last edited by MrOplus
    #1

    hi ,
    i'm trying to execute some RAS commands in Windows everything works fine in QT Creator but when i want to compile the app this error occurs :

    undefined reference to `RasDialDlgW@16'
    

    Headers :

    #include <windows.h>
    #include <stdio.h>
    #include <ras.h>
    #include <rasdlg.h>
    #include <tchar.h>
    
    

    here is my code :

    QString src = QCoreApplication::applicationDirPath() + "/ras.pbk";
      LPTSTR dest=(LPTSTR)src.utf16();
      LPTSTR addr=(LPTSTR)QString("127.0.0.1").utf16();
      LPTSTR entry=(LPTSTR)QString("RasEntry").utf16();
    // LPRASDIALDLG lpInfo = (LPRASDIALDLG) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RASDIALDLG));
      RasDialDlg(dest, entry, addr, NULL);
    

    I'm Using QT 5.7.1 Mingw on windows 10

    kshegunovK 1 Reply Last reply
    0
    • M MrOplus

      hi ,
      i'm trying to execute some RAS commands in Windows everything works fine in QT Creator but when i want to compile the app this error occurs :

      undefined reference to `RasDialDlgW@16'
      

      Headers :

      #include <windows.h>
      #include <stdio.h>
      #include <ras.h>
      #include <rasdlg.h>
      #include <tchar.h>
      
      

      here is my code :

      QString src = QCoreApplication::applicationDirPath() + "/ras.pbk";
        LPTSTR dest=(LPTSTR)src.utf16();
        LPTSTR addr=(LPTSTR)QString("127.0.0.1").utf16();
        LPTSTR entry=(LPTSTR)QString("RasEntry").utf16();
      // LPRASDIALDLG lpInfo = (LPRASDIALDLG) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RASDIALDLG));
        RasDialDlg(dest, entry, addr, NULL);
      

      I'm Using QT 5.7.1 Mingw on windows 10

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      You need to link whatever library provides RasDialDlgW (I'm assuming one of the windows system libs).
      As a side note, this code can't work as you're returning pointers from temporary objects, you'll get segfault in these two places:

      LPTSTR addr=(LPTSTR)QString("127.0.0.1").utf16(); //< The pointer returned from utf16 is valid as long as the string is not modified
      LPTSTR entry=(LPTSTR)QString("RasEntry").utf16();
      

      Read and abide by the Qt Code of Conduct

      M 1 Reply Last reply
      2
      • kshegunovK kshegunov

        You need to link whatever library provides RasDialDlgW (I'm assuming one of the windows system libs).
        As a side note, this code can't work as you're returning pointers from temporary objects, you'll get segfault in these two places:

        LPTSTR addr=(LPTSTR)QString("127.0.0.1").utf16(); //< The pointer returned from utf16 is valid as long as the string is not modified
        LPTSTR entry=(LPTSTR)QString("RasEntry").utf16();
        
        M Offline
        M Offline
        MrOplus
        wrote on last edited by
        #3

        @kshegunov in msdn sample it just used these headers : ras , rasdlg , windows , tchar

        mrjjM 1 Reply Last reply
        0
        • M MrOplus

          @kshegunov in msdn sample it just used these headers : ras , rasdlg , windows , tchar

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @MrOplus
          Hi
          you must also link to
          Rasdlg.dll/lib ( if vs)
          https://technet.microsoft.com/nl-nl/aa377020

          1 Reply Last reply
          1
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            in your .pro file add
            LIBS += -lRasdlg

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            M 1 Reply Last reply
            3
            • VRoninV VRonin

              in your .pro file add
              LIBS += -lRasdlg

              M Offline
              M Offline
              MrOplus
              wrote on last edited by MrOplus
              #6

              @VRonin it works , thanks

              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