How to use Namespaces created in different projects in the same solution?
-
that would be perfect but try explaining that to my dad. lets try this example: file structure: CRYPTO -config.h ZEUS08 -myfile.cpp config.h
NAMESPACE_BEGIN(CryptoPP) typedef unsigned short word16; typedef unsigned int word32; #if defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_CC) #define WORD64_AVAILABLE typedef unsigned long long word64; #define W64LIT(x) x##LL #elif defined(_MSC_VER) || defined(__BORLANDC__) #define WORD64_AVAILABLE typedef unsigned __int64 word64; #define W64LIT(x) x##ui64 #endif
since it has the definition for W64LIT i decided to include it. so i put into my file#include "config.h"
but it gives me fatal error C1083: Cannot open include file: 'config.h': no such file or directory would u please help me with that or give me a link to c++ basics¿?pabloraul wrote:
but it gives me fatal error C1083: Cannot open include file: 'config.h': no such file or directory
Looks like a n include path problem, not a namespace problem. I'm still curious what the NAMESPACE_BEGIN macro expands to... Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
that would be perfect but try explaining that to my dad. lets try this example: file structure: CRYPTO -config.h ZEUS08 -myfile.cpp config.h
NAMESPACE_BEGIN(CryptoPP) typedef unsigned short word16; typedef unsigned int word32; #if defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_CC) #define WORD64_AVAILABLE typedef unsigned long long word64; #define W64LIT(x) x##LL #elif defined(_MSC_VER) || defined(__BORLANDC__) #define WORD64_AVAILABLE typedef unsigned __int64 word64; #define W64LIT(x) x##ui64 #endif
since it has the definition for W64LIT i decided to include it. so i put into my file#include "config.h"
but it gives me fatal error C1083: Cannot open include file: 'config.h': no such file or directory would u please help me with that or give me a link to c++ basics¿?pabloraul wrote:
that would be perfect but try explaining that to my dad.
Give him the keyboard and I will. Is he the one telling you that you don't need to learn how to do C++ development to do C++ development? Who ever is telling you that is wrong. If you try to Internet Forum your way through this project it's going to take you like 1000 times longer than it would if you just stopped and learned C++ fundamentals first and then did the project. Also after you are done you will have learned about a 1 tenth of what you would had you spent the time actually focusing on learning fundamentals rather than focusing on getting the project done.
led mike
-
pabloraul wrote:
but it gives me fatal error C1083: Cannot open include file: 'config.h': no such file or directory
Looks like a n include path problem, not a namespace problem. I'm still curious what the NAMESPACE_BEGIN macro expands to... Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
include path problem, im gonna research about that. about the namespace begin im gonna post few of the files for you to see at least how its supposed to work. wei dai wrote it somehow and it works, i just need to use that library in order to use cryptography in my solution. here is a picture of the object browser for you to see that CryptoPP is a namespace argnames.h
#ifndef CRYPTOPP_ARGNAMES_H #define CRYPTOPP_ARGNAMES_H #include "cryptlib.h" NAMESPACE_BEGIN(CryptoPP) DOCUMENTED_NAMESPACE_BEGIN(Name) #define CRYPTOPP_DEFINE_NAME_STRING(name) inline const char *name() {return #name;} CRYPTOPP_DEFINE_NAME_STRING(ValueNames) //!< string, a list of value names with a semicolon (';') after each name CRYPTOPP_DEFINE_NAME_STRING(Version) //!< int CRYPTOPP_DEFINE_NAME_STRING(Seed) //!< ConstByteArrayParameter CRYPTOPP_DEFINE_NAME_STRING(Key) //!< ConstByteArrayParameter CRYPTOPP_DEFINE_NAME_STRING(IV) //!< const byte * CRYPTOPP_DEFINE_NAME_STRING(StolenIV) //!< byte * CRYPTOPP_DEFINE_NAME_STRING(Rounds) //!< int CRYPTOPP_DEFINE_NAME_STRING(FeedbackSize) //!< int CRYPTOPP_DEFINE_NAME_STRING(WordSize) //!< int, in bytes CRYPTOPP_DEFINE_NAME_STRING(BlockSize) //!< int, in bytes CRYPTOPP_DEFINE_NAME_STRING(EffectiveKeyLength) //!< int, in bits CRYPTOPP_DEFINE_NAME_STRING(KeySize) //!< int, in bits CRYPTOPP_DEFINE_NAME_STRING(ModulusSize) //!< int, in bits CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrderSize) //!< int, in bits CRYPTOPP_DEFINE_NAME_STRING(PrivateExponentSize)//!< int, in bits CRYPTOPP_DEFINE_NAME_STRING(Modulus) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(PublicExponent) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(PrivateExponent) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(PublicElement) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrder) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(Cofactor) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(SubgroupGenerator) //!< Integer, ECP::Point, or EC2N::Point CRYPTOPP_DEFINE_NAME_STRING(Curve) //!< ECP or EC2N CRYPTOPP_DEFINE_NAME_STRING(GroupOID) //!< OID CRYPTOPP_DEFINE_NAME_STRING(PointerToPrimeSelector) //!< const PrimeSelector * CRYPTOPP_DEFINE_NAME_STRING(Prime1) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(Prime2) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(ModPrime1PrivateExponent) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(ModPri
-
include path problem, im gonna research about that. about the namespace begin im gonna post few of the files for you to see at least how its supposed to work. wei dai wrote it somehow and it works, i just need to use that library in order to use cryptography in my solution. here is a picture of the object browser for you to see that CryptoPP is a namespace argnames.h
#ifndef CRYPTOPP_ARGNAMES_H #define CRYPTOPP_ARGNAMES_H #include "cryptlib.h" NAMESPACE_BEGIN(CryptoPP) DOCUMENTED_NAMESPACE_BEGIN(Name) #define CRYPTOPP_DEFINE_NAME_STRING(name) inline const char *name() {return #name;} CRYPTOPP_DEFINE_NAME_STRING(ValueNames) //!< string, a list of value names with a semicolon (';') after each name CRYPTOPP_DEFINE_NAME_STRING(Version) //!< int CRYPTOPP_DEFINE_NAME_STRING(Seed) //!< ConstByteArrayParameter CRYPTOPP_DEFINE_NAME_STRING(Key) //!< ConstByteArrayParameter CRYPTOPP_DEFINE_NAME_STRING(IV) //!< const byte * CRYPTOPP_DEFINE_NAME_STRING(StolenIV) //!< byte * CRYPTOPP_DEFINE_NAME_STRING(Rounds) //!< int CRYPTOPP_DEFINE_NAME_STRING(FeedbackSize) //!< int CRYPTOPP_DEFINE_NAME_STRING(WordSize) //!< int, in bytes CRYPTOPP_DEFINE_NAME_STRING(BlockSize) //!< int, in bytes CRYPTOPP_DEFINE_NAME_STRING(EffectiveKeyLength) //!< int, in bits CRYPTOPP_DEFINE_NAME_STRING(KeySize) //!< int, in bits CRYPTOPP_DEFINE_NAME_STRING(ModulusSize) //!< int, in bits CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrderSize) //!< int, in bits CRYPTOPP_DEFINE_NAME_STRING(PrivateExponentSize)//!< int, in bits CRYPTOPP_DEFINE_NAME_STRING(Modulus) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(PublicExponent) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(PrivateExponent) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(PublicElement) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrder) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(Cofactor) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(SubgroupGenerator) //!< Integer, ECP::Point, or EC2N::Point CRYPTOPP_DEFINE_NAME_STRING(Curve) //!< ECP or EC2N CRYPTOPP_DEFINE_NAME_STRING(GroupOID) //!< OID CRYPTOPP_DEFINE_NAME_STRING(PointerToPrimeSelector) //!< const PrimeSelector * CRYPTOPP_DEFINE_NAME_STRING(Prime1) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(Prime2) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(ModPrime1PrivateExponent) //!< Integer CRYPTOPP_DEFINE_NAME_STRING(ModPri
pabloraul wrote:
include path problem, im gonna research about that.
That's absolutely necessary, since any other problems will be un-fixable until you can successfully include the header files you need. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
pabloraul wrote:
include path problem, im gonna research about that.
That's absolutely necessary, since any other problems will be un-fixable until you can successfully include the header files you need. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
pabloraul wrote:
include path problem, im gonna research about that.
That's absolutely necessary, since any other problems will be un-fixable until you can successfully include the header files you need. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
pabloraul wrote:
NAMESPACE_BEGIN
what the heck is that?
pabloraul wrote:
i mean the project is in my solution why it wont recognize it?
That means nothing. You have to have the namespace header file included for the compiler to know about the namespace.
led mike
led mike wrote:
NAMESPACE_BEGIN what the heck is that?
Some compilers introduced namespaces pretty recently (gcc, for instance), and some libraries are using such macros to take this into account. Xerces-C is doing something similar.
-
by the way, do you have any interesting link about including? cant find anything useful yet...
The #include Directive[^] The first sentence says it all :) Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
The #include Directive[^] The first sentence says it all :) Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
led mike wrote:
NAMESPACE_BEGIN what the heck is that?
Some compilers introduced namespaces pretty recently (gcc, for instance), and some libraries are using such macros to take this into account. Xerces-C is doing something similar.