Author Topic: codeblocks and the use of threads with C  (Read 19308 times)

Offline Rob Rob

  • Single posting newcomer
  • *
  • Posts: 3
codeblocks and the use of threads with C
« on: June 09, 2014, 11:21:14 am »
Hey, I have to divide a program which only consists of the main funktion into threads. Can I perform that with codeblocks? I have read that I have to install the Pthread library in order to use threads.
 (http://openbook.galileocomputing.de/c_von_a_bis_z/026_c_paralleles_rechnen_004.htm)
[11:16:42] El Elroccomo: If that is correct, where can I find the Pthread Bibliothek and how can I embedd it in codeblocks?
« Last Edit: June 09, 2014, 11:27:08 am by Rob Rob »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: codeblocks and the use of threads with C
« Reply #1 on: June 09, 2014, 12:14:03 pm »
C::B IS NOT A COMPILER
c::b IS A IDE
with c::b you write the code, it is basically a text editor with a lot additional features. The compiler is your choice: this depends from operating system and needed functionality.

So: principally you can write code for anything in c::b. But if it is supported from the compiler beneath, this c::b don't know and also doesn't care.

Since you are not posting your compiler, os version, i'm not able to help you future.
I can tell you to read about compilers, and look how your compiler implements pthread. Then you will find out what compiler switch you will need, and then you can ask here how to add this switch in c::b or even better you can read it in the wiki: http://wiki.codeblocks.org/index.php?title=FAQ
if you encounter some compiling/linking errors read and follow this instruction: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

greetings

Offline Rob Rob

  • Single posting newcomer
  • *
  • Posts: 3
Re: codeblocks and the use of threads with C
« Reply #2 on: June 09, 2014, 01:53:06 pm »
I use Xubuntus 13.04 and i use the GCC compiler.
I wanted to use the consol command: gcc-4.2 -Wall -fopenmp -o

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: codeblocks and the use of threads with C
« Reply #3 on: June 09, 2014, 04:18:09 pm »
Well, add -fopenmp in Project->Build Options-> Compiler Settings-> Other Settings
and in Project->Build Options -> Linker settings-> Other linker settings

Offline Rob Rob

  • Single posting newcomer
  • *
  • Posts: 3
Re: codeblocks and the use of threads with C
« Reply #4 on: June 09, 2014, 06:58:45 pm »
what should I write in "other settings"?
and where can I find the linker librarie I needed?
and and what librarie I need?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: codeblocks and the use of threads with C
« Reply #5 on: June 09, 2014, 07:12:07 pm »
what should I write in "other settings"?

The options you want to use; to figure out the options ask the people supporting your compiler!

and where can I find the linker librarie I needed?
and and what librarie I need?

Ask the people supporting your Compiler or Distro!

The Code::Blocks team DOES not support your Compiler or any other compiler directly.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org