0

I need help with installation pthreads to qt.

the thing is I'm making project with winpcap and pcapplusplus wrapper for it. but it still needs pthreads. I have pthreadgc2.dll missing, and I cant figure out how to connect it to my qt project. Basically, program compiles, but crashes once I try to start it in qt. So, I dont really need the pthread and qthread were distributed with qt, I need exactly these libraries: http://ftp.ntua.gr/mirror/mingw/MinGW/Base/pthreads-w32/pthreads-w32-2.9.1/pthreads-w32-2.9.1-1-mingw32-dev.tar.lzma

but there are no dll files either, and I cant understand how to build project with it.

and yes, I'm sure which dll I need, I checked it with dependency walker, but I dont know where to find it. Hope to your help, folks.

seladb
  • 852
  • 1
  • 13
  • 29
0x9093717
  • 11
  • 6

1 Answers1

1

Not all downloadable versions of MinGW work well with pthreads.

There is:

https://sourceforge.net/p/mingw-w64/wiki2/Compile%20pthreads/

that does but I would recommend using TDM-gcc instead, http://tdm-gcc.tdragon.net/. It is more actively maintained and pthreads work out of the box.

You can then simply link with -lpthread in your linking stage

Edd
  • 1,350
  • 11
  • 14
  • this link was really helpful, thank you so much. but still I'm having a problem. I added dlls to /mingw53_32/bin, and program like "started". also my .pro file looks like following: http://pastebin.com/WjzEryCA – 0x9093717 Mar 17 '17 at 13:18
  • program appears in taskmgr but window doesn't show. I dont really know what is happening. – 0x9093717 Mar 17 '17 at 13:20
  • Good mate, the fact that now you added the dll to the path mingw looks for is an important step forward. If the window doesn't show, it sounds like something else could be wrong with your Qt code. Without seeing the whole code is a bit hard to say but are you using both the function window.show() and QApplication::exec() ? take a look here for some extra help: http://stackoverflow.com/questions/4350624/qt-mainwindow-show-does-not-show-the-mainwindow – Edd Mar 17 '17 at 13:33
  • the project literally has no code. I can show it. here http://pastebin.com/AF93pRkP – 0x9093717 Mar 17 '17 at 13:53
  • There are things there that don't make a lot of sense: You declare your class in a namespace but define it in the global namespace; You have your class contain a pointer to itself which you initialize in the constructor. I suggest you take the code from the Qt website, like http://doc.qt.io/qt-5/qtwidgets-desktop-screenshot-example.html, and start from there. – Edd Mar 17 '17 at 14:11
  • hm. It's a default QT code. I typed the only string and planned to look what vector contains in debugger. – 0x9093717 Mar 17 '17 at 14:13
  • here http://pastebin.com/4Qh0Ni14 I just created a new project which runs and shows almost empty default window. – 0x9093717 Mar 17 '17 at 14:20
  • Are you connecting your slot with a the button click signal ? – Edd Mar 17 '17 at 14:41
  • yes. All is quite simple. this string won't execute until I press the button. – 0x9093717 Mar 17 '17 at 14:48