Connecting pthreadgc2.dll to qt project - c++

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.

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

Related

How to Make a Standalone static executable with CLion that can run on anyone's computer for C++?

My question is regarding CLion by JetBrains.
I come to understand that with visual studio there is an option to set the executable to be "multithreaded" and not "multithreaded dll". In other words this would allow for the .exe to be used on anyones computer after compiling.
My question is similar but for CLion.
How in the world do I set the same option inside of CLion? At first when not being able to find it I realized I need to edit CMAKE.txt
I also found that I can use the -static option but when I typed in:
set(CMAKE_EXE_LINKER_FLAGS "-static")
When I put that in it didn't work. What else do I need to do to run a .exe on anyones computer with CLion and how should I go about doing this?
Sorry for not knowing. As a matter of fact I'm new to C++ and just started learning and picked up the C++ Bible to try to learn.
To be honest, I don't see a point in making a program if you can't share it with other people. Even if they installed visual runtime libraries or whatever library they would need it's pretty pointless so that's why I found static is the best way to go.
I just don't know how for CLion.
Thank you.

Using the Qt library in an existing c++ VS2010 program

I'm trying to get the the Qt library to work in an my existing VS2010 project. But I am pretty much stuck.
I have succesuflly compiled the library with nmake on 64 bit and added the Qt adon for vs2010.
But i don't no how to use it in my project, the project makes already use of the boost and the opencv librarys and these work just fine.
I found a thread here on stackoverflow that says I need to edit the vs project file with an text editor but when I do this I cant find the global section that I need to edit.
Can anyone help me with this problem? Thank in advance.
I solved it, wel sort of. I made a new QT project and added my excisting code in the new QT project. I also linked the opencv an boost libs and the application works now!
Thanks for all the comments

trying to set SDL up on Code Blocks

I made a tic-tac-toe game in c++ want to learn how to use SDL so I can make a graphical interface, but I having trouble getting the SDL headers to work. This is really the first library I have had to download and minitech helped me out with decompressing the .gz files, so I got that done but now I don't know how to link it to Code Blocks so that I can use the library.
Make sure to check the CodeBlocks wiki page on using SDL with it, if you haven't already. It explains how to install it and then finally how to link your project to it so you can take advantage of the libraries in your application.
It looks like CodeBlocks supports Dev-C++ "DevPaks" now which is probably an even easier way of installing it than manually copying static libraries around.

How to run C++ program that use PDCurses on other computers?

I've recently started using PDCurses in a C++ game I'm working on. When I compile the program on my own machine (windows) and run the .exe, everything works as it should.
When I take that .exe onto a different computer that doesn't have PDCurses and I try to run it, I get an error about a missing pdcurses.dll file.
After doing a bit of research online, I found out that including the .dll file along with the .exe should make it run but it didn't work for me.
This is how I compiled the program using MinGW: g++ game.cpp -o game -lpdcurses
So my question is, how do I make this program run on computers that don't have PDCurses setup, and also, is there a way to do this by combining the .exe with whatever additional file(s) the system needs to run the program? I've also read that you can do some sort of static linking but so far I've been unable to find a way to do this.
Thanks in advance for the help.
NOTE: In case it matters, I setup PDCurses following this tutorial: http://comptb.cects.com/1848-adding-pdcurses-to-mingw
Not sure if that was the best way to do it but I'm able to compile and run C++ code that uses pdcurses on my computer fine.
Sorry for not posting the exact messages. Here they are:
The first one I got when I didn't include the pdcurses.dll file along with the executable said :
The program can't start because pdcurses.dll is missing from your computer. Try reinstalling the program to fix this problem.
The second one I got after I included the pdcurses.dll:
*The program can't start because libcc_s_dw2-1.dll is missing from your computer. Try reinstalling the program to fix this problem.*
You need to include all the dynamic libraries you linked with. Be careful of licensing, although IIRC there's not much that will bite you with MinGW.
There should be a 'ldd' command if you have the MinGW shell. Try running it on game.exe and it will tell you what libraries you need to run your program. You need to include them all with the exe.
If you want to try and remove the dependency nightmare you can use the static linking (-static) option to your gcc link command. You may not be able to actually do that if you don't have the static versions of your libraries installed. This has other implications - your exe will be bigger and the OS's shared shared page code will not work because it can't tell what parts (DLL code) you are sharing with other apps. In effect, your application will use more memory as a result, although it may be insignificant.
Another option is to get the sources to PDCurses and compile it as a static library. That way you don't have to get involved in the DLL Hell.
Compile it as a C library instead of a C++ library and you should be good to go.

Poppler library for QT4 on windows

I am making a program in which I will include datasheets of PIC processors. I now want to display these inside the QT program itself as a widget. I wanted to use poppler for this, but I am having a very hard time trying to get hold of these binaries! I can't seem to Cmake the poppler for QT4. Could anyone help me on how to make these libraries on Windows 7.
(I have never compiled/build anything yet on Windows, only Unix, I downloaded the CMAKE program, and tried to use this to generate it with the CMakeLists.txt file, but no luck so far.)
The best solution (because this way I could learn it myself, and never have this problem again) is a 'tutorial' on how to do it myself.
If not then giving me the libraries itself would be very much appreciated!
I'd wanted to point you to SumatraPDF, but it looks like they're not using poppler any more. You could have a look at the mupdf subdirectory though, it has MSVC makefiles for several libraries required for poppler. You might have some luck adapting them for building libpoppler itself.
You could also use Cygwin or MingW to get/build poppler.
You might have to take a look at this: Poppler: Displaying PDF Files with Qt
You can use the KDEWin installer to automatically get all the appropriate binaries for your machine. This is very useful and is the strategy used in many projects (including my CarMusTy, Carnatic Music Typesetting application).
Check out: http://www.winkde.org/pub/kde/ports/win32/installer/
It automatically downloads all the required dependencies when you ask it download the required binaries. And you can get the dlls suited for your particular compiler. (MSVC, MingW supported)
Also you can get the source code for poppler. KDEWin supports versions, so you can get the latest version binaries or any previous version you like.
Check out http://windows.kde.org/ for more details.
All the best
Gopalakrishna Palem
Creator of CFugue and CarMusTy
http://gpalem.web.officelive.com/