Skip to main content
gamedev.net
🔒 Locked

header file

Started by OB1st Jun 19, 2002 at 6:32 AM 7 replies 250+ views
Original Post
OB1st
OB1st
Hellow I got this code (below)from example tutorial. I read a lot in C++, I could not find where to obtain these long numbers from to include in my header file because I want to add a new class ---------------------- #if !defined(AFX_CUBOID_H__AE25AF5F_AE56_48F5_99DC_47CAAA14F245__INCLUDED_) #define AFX_CUBOID_H__AE25AF5F_AE56_48F5_99DC_47CAAA14F245__INCLUDED_ ---------------------- Could any one help by just providing a clue. Best regards
I would love going home to M7, but I can't detect black holes.
jeeky
jeeky
They are randomly generated by DevStudio to ensure that your class is uniquely defined. In manual implementations it is common to just do something like:

#ifndef H_CLASSNAME_H
#define H_CLASSNAME_H

//code goes here

#endif //H_CLASSNAME_H
OB1st
OB1st
Thanks a lot
I would love going home to M7, but I can't detect black holes.
Lord Skeletor
Lord Skeletor
Hi!

There''s a small utility called "guidgen.exe" out there.
This microsoft product creates a unique ID for several types of need:

- Unique registry entries
- DirectX-GUIDs
- Headerfile heads as explained at the top of this thread
- and some more i think...

Microsoft guaranties the uniquity (does this word exist?) of the generated ID and there will be no second on this world.

Just go and find the software on the net. Sometimes it''s even integrated to Visual Studio (.Net) I think. Go and search your HD for guidgen.exe, you may be lucky

But...! Why don''t you just use

#pragma once

This should do its job for Visual C++!

cu,
Lord
Chem0sh
Chem0sh
One small warning about #pragma once. I read somewhere that not all compilers support it (though all the ones I''ve used do). In fact, I think all of the #pragma directives are compiler dependent (someone please correct me on this if I''m wrong). GCC will complain that "#pragma once is obsolete", but it works anyway.

/*=========================================*/
/* Chem0sh */
/* Lead Software Engineer & Tech Support */
/* http://www.eFaces.biz */
/*=========================================*/
/*=========================================// Chem0sh// Lead Software Engineer & Tech Support// http://www.eFaces.biz=========================================*/
Fruny
Fruny
quote:
Original post by Chem0sh
In fact, I think all of the #pragma directives are compiler dependent (someone please correct me on this if I''m wrong).



That''s the very definition of a #pragma directive
A compiler is supposed to ignore #pragma which do not make sense to it.

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Chem0sh
Chem0sh
Oh, yeah! I forgot I knew that. I remember reading that somewhere now. Thanks, Fruny!

/*=========================================*/
/* Chem0sh */
/* Lead Software Engineer & Tech Support */
/* http://www.eFaces.biz */
/*=========================================*/
/*=========================================// Chem0sh// Lead Software Engineer & Tech Support// http://www.eFaces.biz=========================================*/
Oluseyi
Oluseyi
quote:
Original post by Lord Skeletor
uniquity (does this word exist?)

Uniqueness. Aber du hast besser getan als meistens Amerikaner mit Deutsche.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.