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. How to use Namespaces created in different projects in the same solution?

How to use Namespaces created in different projects in the same solution?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpcsharpvisual-studiocryptography
15 Posts 4 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.
  • P pabloraul

    about the NAMESPACE_BEGIN(CryptoPP), i really dont know. the compiler understands that it its the beggining of the namespace and at the end of the file theres a NAMESPACE_END. when i look at the object browser it has something like this: CRYPTO {}CryptoPP //meaning that cryptopp is inside crypto {}Std about including the header file of the namespace, i dont now which one since every file of the class has that thing inside... by the way, i cant even include the files of CRYPTO into de files of ZEUS example: #include "config.h" //cannot include file, no such file or directory

    modified on Tuesday, April 1, 2008 1:13 PM

    L Offline
    L Offline
    led mike
    wrote on last edited by
    #4

    pabloraul wrote:

    i dont now which one since every file of the class has that thing inside

    Well you have to include every header file that defines any class that you want to use anyway. If you are really this confused about header files and namespaces you might need to learn a little more about C++ fundamentals before attempting your project.

    led mike

    P 1 Reply Last reply
    0
    • L led mike

      pabloraul wrote:

      i dont now which one since every file of the class has that thing inside

      Well you have to include every header file that defines any class that you want to use anyway. If you are really this confused about header files and namespaces you might need to learn a little more about C++ fundamentals before attempting your project.

      led mike

      P Offline
      P Offline
      pabloraul
      wrote on last edited by
      #5

      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¿?

      M L 2 Replies Last reply
      0
      • P pabloraul

        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¿?

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #6

        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:

        P 1 Reply Last reply
        0
        • P pabloraul

          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¿?

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #7

          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

          1 Reply Last reply
          0
          • M Mark Salsbery

            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:

            P Offline
            P Offline
            pabloraul
            wrote on last edited by
            #8

            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

            M 1 Reply Last reply
            0
            • P pabloraul

              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

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #9

              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:

              P L 2 Replies Last reply
              0
              • M Mark Salsbery

                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:

                P Offline
                P Offline
                pabloraul
                wrote on last edited by
                #10

                by the way, do you have any interesting link about including? cant find anything useful yet...

                M 1 Reply Last reply
                0
                • M Mark Salsbery

                  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:

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #11

                  zzzzzzzzzzzzzzzzzzzt What's that sound I hear? Seems familiar. This is almost reel interesting :~

                  led mike

                  1 Reply Last reply
                  0
                  • L led mike

                    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

                    N Offline
                    N Offline
                    Nemanja Trifunovic
                    wrote on last edited by
                    #12

                    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.

                    Programming Blog utf8-cpp

                    L 1 Reply Last reply
                    0
                    • P pabloraul

                      by the way, do you have any interesting link about including? cant find anything useful yet...

                      M Offline
                      M Offline
                      Mark Salsbery
                      wrote on last edited by
                      #13

                      The #include Directive[^] The first sentence says it all :) Mark

                      Mark Salsbery Microsoft MVP - Visual C++ :java:

                      P 1 Reply Last reply
                      0
                      • M Mark Salsbery

                        The #include Directive[^] The first sentence says it all :) Mark

                        Mark Salsbery Microsoft MVP - Visual C++ :java:

                        P Offline
                        P Offline
                        pabloraul
                        wrote on last edited by
                        #14

                        yay! thenks Mark, that was the answer i was looking for, ill code it later since i have to go out. take care everyone

                        1 Reply Last reply
                        0
                        • N Nemanja Trifunovic

                          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.

                          Programming Blog utf8-cpp

                          L Offline
                          L Offline
                          led mike
                          wrote on last edited by
                          #15

                          Thanks

                          led mike

                          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