User forums > Using Code::Blocks

OpenMP

(1/3) > >>

biotech54:
I'm trying to get OpenMP programs to compile using CB.  I read previous OpenMP discussions on this forum, written about 7 years ago.  However, I did not understand what they were talking about, and i'm sure CB has changed since 2010.  Does anyone know what i need to click, what settings i need to change, so that my OpenMP programs will compile?  I get error messages when i try to compile simple five line programs.  Thanks,
Edward

stahta01:
http://forums.codeblocks.org/index.php?topic=22123.0

biotech54:
Thanks, but just too complicated for me.

stahta01:

--- Quote from: biotech54 on September 22, 2017, 05:38:00 am ---Thanks, but just too complicated for me.

--- End quote ---

If using a project and posting a build log is too complex for you.
Then, using OpenMP is likely too complex for you, at least till you can do both of those items.

Tim S.

biotech54:
oh sorry, i didn't know you wanted to see the build log.  Here is the program, and build log.  I'm using Windows 7.

#include <stdio.h>
#include <stdlib.h>
#include <omp.h>

void hello();

int main()
{
   int threadCount = 4
   #pragma omp parallel num_threads(threadCount)
   hello();

   return 0;
}

void hello(){

   int myRank = omp_get_thread_num();
   int threadCount = omp_get_num_threads();
   printf("thread %d of %d\n", myRank, threadCount);
}


-------------- Build: Debug in OpenMPTest (compiler: GNU GCC Compiler)---------------

mingw32-gcc.exe -Wall -g  -c C:\MyHomeComputer\MyCppProjects\OpenMPTest\main.c -o obj\Debug\main.o
C:\MyHomeComputer\MyCppProjects\OpenMPTest\main.c: In function 'main':
C:\MyHomeComputer\MyCppProjects\OpenMPTest\main.c:11:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
    #pragma omp parallel num_threads(threadCount)
 ^
C:\MyHomeComputer\MyCppProjects\OpenMPTest\main.c:12:4: error: expected ',' or ';' before 'hello'
    hello();
    ^
C:\MyHomeComputer\MyCppProjects\OpenMPTest\main.c:10:8: warning: unused variable 'threadCount' [-Wunused-variable]
    int threadCount = 4
        ^
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 2 warning(s) (0 minute(s), 0 second(s))
 


Navigation

[0] Message Index

[#] Next page

Go to full version