compilation warning # pragma once

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Subrat

    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


  • red floyd

    #2
    Re: compilation warning # pragma once

    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

    Comment

    • Jim Langston

      #3
      Re: compilation warning # pragma once

      "Subrat" <subrat.sahani@ in.bosch.comwro te in message
      news:g4f2ep$cmu $1@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.


      Comment

      • James Kanze

        #4
        Re: compilation warning # pragma once

        On Jul 2, 10:42 am, "Jim Langston" <tazmas...@rock etmail.comwrote :
        "Subrat" <subrat.sah...@ in.bosch.comwro te in message
        news:g4f2ep$cmu $1@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:james.kan ze@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

        Comment

        Working...