[Solved] undefined reference to `RasDialDlgW@16'
-
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
-
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
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();
-
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();
@kshegunov in msdn sample it just used these headers : ras , rasdlg , windows , tchar
-
@kshegunov in msdn sample it just used these headers : ras , rasdlg , windows , tchar
@MrOplus
Hi
you must also link to
Rasdlg.dll/lib ( if vs)
https://technet.microsoft.com/nl-nl/aa377020