QUdpSocket bind problem
- 
@JulsPower
Can you show me where in your code calling WSAGetLastError()? - 
@JulsPower
Can you show me where in your code calling WSAGetLastError()?@Hanson said in QUdpSocket bind problem:
@JulsPower
Can you show me where in your code calling WSAGetLastError()?b = m_UdpSocket->bind(QHostAddress::Any, 55555); auto state = m_UdpSocket->state(); QMessageBox::information(this, "info", QString(b?"true ":"false ") + QString::number(state) + QString::number(WSAGetLastError()));show while debugging it shows false 010106
 - 
I replicated the samething in a new project using qmake instead of cmake. lo and behold it works in debugging mode...
seem ill be using qmake@JulsPower
Maybe same as this question
https://stackoverflow.com/questions/48597996/qtcpserver-return-unknown-error-on-listen-function-only-under-debugger
https://developercommunity.visualstudio.com/t/native-cmake-support-application-debug-launch-is-b/562174So the reason could be that when debugging the program with cmake project, the environment variables were cleared and the SystemRoot variable was missing, which caused WSASocket to fail to load the related components.
 - 
J JulsPower has marked this topic as solved on
 - 
@JulsPower I understand you probably lack the motivation and time to do it, but it would be interesting to see the differences in the build between cmake generated makefile an qmake generated makfile. Obviously the two are building/linking differently. Smells like a build flag isn't the same in cmake debug