473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Warning message

When I compile the program I have the follwing message

In function 'int main()'

ignoring #pragma omp for

The code is following

#ifdef _OPENMP
#include <omp.h>
#endif
int main()
{
# pragma omp for
{
for (int i=0; i<=10 i++)
{}
}
return o;
can somebody help me.

}
Nov 2 '08 #1
14 1851
JosAH
11,448 Expert 8TB
And what is "#pragma omp for" supposed to mean? Unknown pragmas are
supposed to be ignored by the compiler.

kind regards,

Jos

ps. I removed your email address for your own privacy.
Nov 2 '08 #2
How I can execute the omp parallel directive
can you please mentioned what is the mistake.
Nov 2 '08 #3
JosAH
11,448 Expert 8TB
How I can execute the omp parallel directive
can you please mentioned what is the mistake.
I'm sure your manual describes all the nitty-gritty details about its own compiler's
pragma directives.

kind regards,

Jos
Nov 2 '08 #4
Banfa
9,065 Expert Mod 8TB
simuumar, are you aware that #pragma is a directive to a specific compiler on a specific platform. The standard says little about them except that, as Jos says, unknown pragmas should be ignored by any compiler.

Part from that there is most no relationship between pragmas on 1 platform and another. Anything we could have to say about the pragmas we know would be completely irrelevant to your unknown platform.

To know how the pragam you have used or the pragma you want to use works you will need to read the documentation for your compiler/platform.
Nov 2 '08 #5
Can u please send me any complete example.
please.so that i can understand.
Nov 2 '08 #6
Banfa
9,065 Expert Mod 8TB
Here is an example

#pragma once

For the Microsoft Compiler (Visual C++/Visual Studio) when used in a header (.h) file it ensures that the file is only included into the code once in a way that is marginally more efficient than using #ifndef inclusion protection and speeds up complication marginally.

Some other compilers may support that pragma but there is no guarantee.
Nov 2 '08 #7
Here is an example

#pragma once

For the Microsoft Compiler (Visual C++/Visual Studio) when used in a header (.h) file it ensures that the file is only included into the code once in a way that is marginally more efficient than using #ifndef inclusion protection and speeds up complication marginally.

Some other compilers may support that pragma but there is no guarantee.

# ifdef _OPENMP
# include < omp.h >
# endif
int main()
{
int i,id ;
#pragma once
{
for (i = 0; i<4; ++i )
{
int id = omp_get_thread_num ();

return 0;

}
}
}


I am compiling the above code but its not working.Please help.
or correct the above please
Nov 2 '08 #8
JosAH
11,448 Expert 8TB
Banfa gave you an example for a compiler bound pragma; not something to be
copied/pasted (to the wrong location) and to be compiled without any understanding.

kind regards,

Jos
Nov 2 '08 #9
Banfa gave you an example for a compiler bound pragma; not something to be
copied/pasted (to the wrong location) and to be compiled without any understanding.

kind regards,

Jos
Can I have some program using pragma
Nov 2 '08 #10
JosAH
11,448 Expert 8TB
Can I have some program using pragma
No; start reading your compiler manual.

Jos

ps. and don't repeat your same question over and over again. We have given
you the answers you need.
Nov 2 '08 #11
No; start reading your compiler manual.

Jos

ps. and don't repeat your same question over and over again. We have given
you the answers you need.


so can u provide me some understanding. Atleast i can run the progrma please.Then I will understand automatically.
Nov 2 '08 #12
JosAH
11,448 Expert 8TB
so can u provide me some understanding. Atleast i can run the progrma please.Then I will understand automatically.
Banfa already gave you a perfect example: '#pragma once'; it belongs in a .h file
and not in a .c or .cpp file as was clearly explained. For other pragmas read your
fine compiler manual; I'm sure you'll find some. All pragmas are tied to a compiler,
i.e. they don't make sense for another compiler and are ignored, possibly after
issueing a warning message.

kind regards,

Jos
Nov 2 '08 #13
donbock
2,426 Expert 2GB
What compiler (version/vendor) are you using. Pragmas are compiler-specific. The examples you've been given are only valid for the compilers used by the respondents. It is truly impossible for anybody here to guess which pragmas are supported by your compiler. If you tell us your compiler vendor then there is a chance we can help you -- but there are no guarantees: you might be using a compiler unfamiliar to us.

By the way, are you using the same compiler that was used to originally write the code? If not, then you're porting the code to a new build environment. With careful discipline, C code can be written so that it ports uneventfully to another environment. On the other hand, C code can be written in ways that are a nightmare to port. Pragmas are one of the most nonportable parts of the language. If your code contains pragmas then I wonder if it contains other dependencies on nonportable features.
Nov 3 '08 #14
RedSon
5,000 Expert 4TB
so can u provide me some understanding. Atleast i can run the progrma please.Then I will understand automatically.
No one can provide you with some understanding, it is your responsibility to take what we have told you and learn from it. You will not understand automatically if someone wrote a program for you that has some pragma statements in it because you clearly don't have the slightest clue what pragma means.

Here is some information on the Microsoft compiler's pragma directives (http://msdn.microsoft.com/en-us/libr...05(VS.71).aspx) you can use it to get an idea of what they are but if you are not using Microsoft's compiler these directives will be useless for you.
Nov 3 '08 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: rob | last post by:
Hey, I'm getting an error message (C4786) while compiling some code that contains a vector of strings "vector <string> myVector(4);" i've added "#pragma warning(disable:4786)" to the...
12
by: prashna | last post by:
Hi all, I am new to C and I am working on some simple programs.I am getting the following warning which I am not able to find what it is, please let me know what is causing this warning.Also What...
29
by: junky_fellow | last post by:
Consider the following piece of code: struct junk { int i_val; int i_val1; char c_val; }; int main(void) {
1
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i...
3
by: Chuck Cobb | last post by:
I'm doing a CSharp project in VS2005 and I'm getting some strange warning messages. The problem is that the warning messages don't link to anything in my code so they are very difficult to track...
5
by: Peter Ritchie [C# MVP] | last post by:
I've purposely been ignoring a CA2122 warning in some C++ interop code I've been working on for quite some time. I've just recently had the cycles to investigate the warning. The warning message...
1
by: Ian | last post by:
I've just discovered the msclr::lock class in the C++ Support Library online documentation. This seems like a much cleaner way to implement thread protection than using...
2
by: BSeab1024SE | last post by:
In MS Visual C++ some code I wrote generated the warning "conversion from 'int' to 'const float', possible loss of data." In the process of trying to determine if I could rewrite the code to...
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
4
by: cody | last post by:
It is possible to declare and use/instantiate a class with a uninitialized readonly field without even a compiler warning. Why don't I get warnings? public class Stuff { public readonly int a;...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.