Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Header Wrapper Symbol

Header Wrapper Symbol

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpvisual-studio
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    steph5
    wrote on last edited by
    #1

    Hi Guys I am a new comer to programming and this forum. I have been looking at some code I found on the internet and in the header files they have what i believe are called header wrappers. Which I understand are to stop the header file from being defined more than once. The code looks like this: #if !defined(AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_) #define AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "myFunction.h" namespace Ovalkey { //class definitions }; #endif My question is why the strange symbol AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_ Is this something generated by Visual Studio? or just some strange thing the programmer decided to call the variable? Many thanks

    B B 2 Replies Last reply
    0
    • S steph5

      Hi Guys I am a new comer to programming and this forum. I have been looking at some code I found on the internet and in the header files they have what i believe are called header wrappers. Which I understand are to stop the header file from being defined more than once. The code looks like this: #if !defined(AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_) #define AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "myFunction.h" namespace Ovalkey { //class definitions }; #endif My question is why the strange symbol AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_ Is this something generated by Visual Studio? or just some strange thing the programmer decided to call the variable? Many thanks

      B Offline
      B Offline
      Bram van Kampen
      wrote on last edited by
      #2

      This strange constant was generated by your friendly MFC Wizzard, when you used it to generate the Class Files. It is based on a GUID (Globally Unique Identifier). It's purpose is to ensure that this constant is unique in the world for your header. I.e. Someone else anywhere anytime who decides to generate a Class CMyDerivative, will have a different constant. :)

      Bram van Kampen

      1 Reply Last reply
      0
      • S steph5

        Hi Guys I am a new comer to programming and this forum. I have been looking at some code I found on the internet and in the header files they have what i believe are called header wrappers. Which I understand are to stop the header file from being defined more than once. The code looks like this: #if !defined(AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_) #define AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "myFunction.h" namespace Ovalkey { //class definitions }; #endif My question is why the strange symbol AFX_MYDERIVATIVE_H__AC73BB0F_CC43_4B4B_850A_4DC13A664B8C__INCLUDED_ Is this something generated by Visual Studio? or just some strange thing the programmer decided to call the variable? Many thanks

        B Offline
        B Offline
        bob16972
        wrote on last edited by
        #3

        To add to the other reply, It seems Visual C++ class wizard stopped putting these in class files after VC++ 6.0 so if your using a newer Visual C++ IDE, you probably won't see these in classes created with those newer IDE's. For what it's worth.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups