473,405 Members | 2,294 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,405 software developers and data experts.

compilation warning # pragma once

Hello,
I have used #pragma once in a header file.
During compilation I get a warning : #pragma once is obsolete.
How do I switch off this warning, without making any change to my make file?

Thanks in Advance,
Subrat
Jul 2 '08 #1
3 3876
Subrat wrote:
Hello,
I have used #pragma once in a header file.
During compilation I get a warning : #pragma once is obsolete.
How do I switch off this warning, without making any change to my make file?

Thanks in Advance,
Subrat

Wrong group. #pragma's are implementation specific. How to disable
warnings is implementation specific. Try a group with microsoft or
vc in its name.

See FAQ 5.9 http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Jul 2 '08 #2
"Subrat" <su***********@in.bosch.comwrote in message
news:g4**********@news4.fe.internet.bosch.com...
Hello,
I have used #pragma once in a header file.
During compilation I get a warning : #pragma once is obsolete.
How do I switch off this warning, without making any change to my make
file?
Easiest way, go into the header file, remvoe #pragma once and replace it
with the proper include guards.
#ifndef MYFILE_H
#define MYFILE_H

// header here

#endif

MYFILE_HEADER
is also sometimes used.
Jul 2 '08 #3
On Jul 2, 10:42 am, "Jim Langston" <tazmas...@rocketmail.comwrote:
"Subrat" <subrat.sah...@in.bosch.comwrote in message
news:g4**********@news4.fe.internet.bosch.com...
I have used #pragma once in a header file.
During compilation I get a warning : #pragma once is obsolete.
How do I switch off this warning, without making any change to my make
file?
Easiest way, go into the header file, remvoe #pragma once and replace it
with the proper include guards.
#ifndef MYFILE_H
#define MYFILE_H
// header here
#endif
MYFILE_HEADER
is also sometimes used.
Many different conventions are sometimes used (inluding some
which are formally illegal, e.g. _MYFILE_H). The important
point is to avoid the risk of collisions. For this reason, most
libraries will try to munge the name of the library into the
guard (e.g. BOOST_..._INCLUDED); anything really professional
will probably include some sort of random sequence as well. (I
get toto_hh_20080702Jbqi2me5hF1pQrgColbxnIMk for a file toto.hh,
although I'll get something else if I create it again; the last
24 characters are generated from input from /dev/random.
Another possibility might be an MD-5 or SHA-1 digest of the
hostname and the full pathname from the root, or the filename,
programmer name and the current time and date.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jul 2 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Raja Koduru | last post by:
Hello everybody, I am not yet fully comfortable with understanding c++ warnings/error messages. Very recently I have updated my IDE to VC++7.0 (MS.Net 7.0-Enterprise architect) from vc++6....
40
by: Dave Hansen | last post by:
Please note crosspost. Often when writing code requiring function pointers, it is necessary to write functions that ignore their formal parameters. For example, a state machine function might...
6
by: Kim Hellan | last post by:
I want to suppress the following warning when compiling. warning CS0169: The private field 'myvar' is never used In C++ you would do something like (not sure of the syntax): #pragma nowarn:0169...
3
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition...
12
by: Herby | last post by:
Iv compiled my current C++ project as \clr as i want to start putting in some specific C++\CLI code to serialize my MFC objects to .NET equivalents. The program crashes on startup, something to do...
2
by: Siemel Naran | last post by:
I keep getting warning messages like these: ....\include\myfile.h(451) : warning C4251: 'MyClass::m_myvariable' : class 'CPtrArray' needs to have dll-interface to be used by clients of class...
16
by: junky_fellow | last post by:
Guys, I have put the following two lines in a header file to prevent it from getting included multiple times. #ifndef __MY_HDR.H__ #define __MY_HDR.H__ // Some macros here
26
by: Rick | last post by:
I'm told that "#pragma once" has made it into the ISO standard for either C or C++. I can't find any reference to that anywhere. If it's true, do any of you have a reference I can use? ...
4
by: | last post by:
Hi, After installing SP1 for VS2008 and SP1 for .NET 3.5 we get the following warning in a VS2005 build: error CS0618: Warning as Error: 'System.Windows.UIElement.BitmapEffect' is obsolete:...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.