\ EEE4084F - Digital Systems

Help:  compiling pthreads in Code::Blocks


If you are trying to compile Prac2 (pthreads) on Windows this info would probably be useful for you (if you haven't got the compiling working yet)

To compile Prac2 on Windows using CodeBlocks you need to add the pthreads library, it is not by default available in the CodeBlocks for Windows (if using DevC++ see below).

CodeBlocks for Windows pthread fix


Get hold of pthreads-w32-2-9-1-release.zip

The procedure to incorporate the library into MinGW for CodeBlocks is as follows:

1. unzip pthreads-w32-2-9-1-release.zip into its own directory

2. Go into directory pthreads-w32-2-9-1-release\Pre-built.2

3. Copy all the h files from pthreads-w32-2-9-1-release\Pre-built.2\include  into the MinGW include directory, usually in C:\Program Files (x86)\CodeBlocks\MinGW\include

4. Copy all the library files in pthreads-w32-2-9-1-release\Pre-built.2\lib\x86 into directory C:\Program Files (x86)\CodeBlocks\MinGW\lib

5. Added the -lpthreadGC2 option into Project --> Build Options --> Linker Settings --> Other Linker Options of the CodeBlocks IDE

(also make sure that "jpeg"  is in is in Project --> Build Options --> Linker Settings --> Link Libraries

The project then should compile fine on Windows.

DevC++ for Windows pthread fix


For this you just need to install the package pthreads_w32-2.8.0-1aj.DevPak. This file is in Resources/LIBS  in the zip file DevC++ Libs.zip

Close DevC++ and double click on the pthreads_w32-2.8.0-1aj.DevPak  agree to installing (the system should recognize .DevPak extension and open the package manager).

Once that is successfully installed, quit the package manager and load DevC++, which should now work fine for compiling pthreads, and should be happy with linking in the libjpeg library that is included in the Prac2 zip file.

 
 g