473,804 Members | 3,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3902
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.comwro te in message
news:g4******** **@news4.fe.int ernet.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...@rock etmail.comwrote :
"Subrat" <subrat.sah...@ in.bosch.comwro te in message
news:g4******** **@news4.fe.int ernet.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_..._INCLU DED); anything really professional
will probably include some sort of random sequence as well. (I
get toto_hh_2008070 2Jbqi2me5hF1pQr gColbxnIMk 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 objektorientier ter Datenverarbeitu ng
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
4910
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. Initially the same code used to compile without any messages. Now the following warning/error messages are appearing. I don't think this it is related some source code of mine. Otherwise I would have pasted the my code here.
40
7908
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 take a status input, but a certain error-handling state might ignore it: typedef void (*State_Fn)(uint8_t); void error_state(uint8_t status)
6
13855
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 string myvar; #pragma warn:0169 Is this really still not possible in C#? I know you can set the /nowarn:0169 option in you project, but I do not want
3
3354
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 from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\1f575646\ad3a161b\assembly\dl2\57ca505e\044565c0_f84fc401\Test1.DLL' The problem is that the control is defined in two different assemblies
12
4613
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 with the stack frame being corrupted. My first concern is the program has ballooned in terms of the size of the executable image. When it attempts to run it fails and some report about stack frame corruption.
2
31665
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 'MyClass' D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\af xcoll.h(367) : see declaration of 'CPtrArray' How can I get rid of the warnings.
16
7421
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
3832
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? Thanks...
4
2035
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: 'Avoid using BitmapEffects as they have very poor performance characteristics. They will be deprecated in a future version. Consider using the UIElement.Effect property and ShaderEffects where appropriate instead.'
0
9588
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10589
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.