And there was only one entry in the backtrace? Did you compile your application in debug mode?Originally Posted by OnionRingOfDoom
Anyway, you try to read data from the socket before they arrive --- you must wait for readyRead() signal.
And there was only one entry in the backtrace? Did you compile your application in debug mode?Originally Posted by OnionRingOfDoom
Anyway, you try to read data from the socket before they arrive --- you must wait for readyRead() signal.
...How do I compile it in debug mode?
Add "CONFIG += debug" to your .pro file (and remove "release" if it's there).Originally Posted by OnionRingOfDoom
Ok so I changed the connection to do the readSpeed() function whenever readyRead() was emitted. However, now nothing happens when the client connects.
I also added a new connection at the end of the acceptConnection() function, which is as follows: connect(slider, SIGNAL(valueChanged(int)), this, SLOT(sendSpeed()));
so now, whenever I move the slider (and it outputs valueChanged signal), it crashes.
Last edited by OnionRingOfDoom; 26th January 2006 at 22:08.
After further fiddling, it seems that it's not the server's writing to the IO device that's the problem, it's the client's reading from the IO device that's causing the crash. Moving the slider thus causes the server to write data, and the client tries to read it or something, but crashes.
Does it crash if you change MainWindow::readSpeed() to:?Qt Code:
void MainWindow::readSpeed() { label->setNum(0); }To copy to clipboard, switch view to plain text mode
Did you try to generate that backtrace again?
yes, it still crashes, oddly enough...
and I'm trying to compile in debug mode, but I have to fix all these errors switching to debug mode seems to have created.
Oh awesome! It's acting like it can't find the QtNetwork include file anymore...
Any idea why adding that CONFIG thing to the .pro file would make it think it couldn't find QtNetwork, but could still find every other Qt file I included?
Last edited by OnionRingOfDoom; 26th January 2006 at 23:07.
Is that label variable initialized?Originally Posted by OnionRingOfDoom
Can it find "QTcpSocket? Did you compile Qt in debug mode or maybe you have only release version?Originally Posted by OnionRingOfDoom
First question: yes, it is initialised
And I fixed the other problem, when I remade the .pro file, it didn't put in the
QT += network thing.
Last edited by OnionRingOfDoom; 27th January 2006 at 00:12.
and now it almost finishes compiling in debug mode... but MinGW comes up with some weird error I'm totally not responsible for:
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\ mingw32\bin\ld.exe: cannot find -lqtmain
But at least it still compiles in release mode. But it still crashes whenever the client trys to even do anything with the readyRead function.
Last edited by OnionRingOfDoom; 27th January 2006 at 00:29.
Anyone else got any ideas?
Did you compile Qt in debug mode? Do you have the libqtmain.a and libqtmaind.a files in %QTDIR%\lib directory?Originally Posted by OnionRingOfDoom
Does it crash with empty MainWindow::readSpeed()?But it still crashes whenever the client trys to even do anything with the readyRead function.
Also add "CONFIG += console" to your .pro file and see whether your program outputs something to the console.
No, it does not crash when readSpeed() is empty.Originally Posted by jacek
And no, it doesn't write anything to the console.
I'm gonna try to reinstall Qt in debug mode this afternoon, after school
Could you post the line in which you initialize that label variable?Originally Posted by OnionRingOfDoom
As for the label, it's initialized like so:
Qt Code:
To copy to clipboard, switch view to plain text mode
...............
Wait a sec...... *checks the .h file*
Oh....
I initialised the label variable twice....
**facepalms**
problem solved....
Last edited by OnionRingOfDoom; 27th January 2006 at 19:29.
Heh, thanks for your help through all this! I tend to have other people ask me some question and then I realise a stupid error I made...
Bookmarks