Code::Blocks Forums

User forums => Embedded development => Topic started by: Rob Rob on June 09, 2014, 11:21:14 am

Title: codeblocks and the use of threads with C
Post by: Rob Rob 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?
Title: Re: codeblocks and the use of threads with C
Post by: BlueHazzard 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
Title: Re: codeblocks and the use of threads with C
Post by: Rob Rob 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
Title: Re: codeblocks and the use of threads with C
Post by: BlueHazzard 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
Title: Re: codeblocks and the use of threads with C
Post by: Rob Rob 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?
Title: Re: codeblocks and the use of threads with C
Post by: stahta01 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.