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. Problem with DLL

Problem with DLL

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++graphicsquestion
12 Posts 6 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.
  • N Offline
    N Offline
    Nandu_77b
    wrote on last edited by
    #1

    Hi, We have create a C++ DLL. While creating this DLL we have included "string.h" "vector.h" etc and so on... We are able to compile and able to use exported functions in sample program with out any error. We have distributed our DLL with .lib and .h files. He reports that when he includes our .h file in his program, it is not compiling (compile or link errors). He is tell this is boz because it has multiply defines. Is there any way to avoide this? -Nandu

    L T C 3 Replies Last reply
    0
    • N Nandu_77b

      Hi, We have create a C++ DLL. While creating this DLL we have included "string.h" "vector.h" etc and so on... We are able to compile and able to use exported functions in sample program with out any error. We have distributed our DLL with .lib and .h files. He reports that when he includes our .h file in his program, it is not compiling (compile or link errors). He is tell this is boz because it has multiply defines. Is there any way to avoide this? -Nandu

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

      Nandu_77b wrote:

      We have distributed our DLL with .lib and .h files. He reports that when he includes our .h file in his program, it is not compiling (compile or link errors). He is tell this is boz because it has multiply defines. Is there any way to avoide this?

      Yes. Before distributing your DLL,lib and H files to "him", test them in your own project before you distribute them.

      led mike

      L 1 Reply Last reply
      0
      • N Nandu_77b

        Hi, We have create a C++ DLL. While creating this DLL we have included "string.h" "vector.h" etc and so on... We are able to compile and able to use exported functions in sample program with out any error. We have distributed our DLL with .lib and .h files. He reports that when he includes our .h file in his program, it is not compiling (compile or link errors). He is tell this is boz because it has multiply defines. Is there any way to avoide this? -Nandu

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        probably because he is including your header several times, and because your header is not robust. have you set an exclusive inclusion system in it (like the following) ?

        //header.h

        #pragma once //depending on the compiler. not all support this

        //your header body here...

        //header.h

        #ifndef __HEADER_H_INCLUDED__
        #define __HEADER_H_INCLUDED__

        //your header body here...

        #endif

        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        N T 2 Replies Last reply
        0
        • L led mike

          Nandu_77b wrote:

          We have distributed our DLL with .lib and .h files. He reports that when he includes our .h file in his program, it is not compiling (compile or link errors). He is tell this is boz because it has multiply defines. Is there any way to avoide this?

          Yes. Before distributing your DLL,lib and H files to "him", test them in your own project before you distribute them.

          led mike

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          :confused: first debugging, now testing. What will you ask for next, documentation?

          Luc Pattyn [Forum Guidelines] [My Articles]


          Voting for dummies? No thanks. X|


          L 1 Reply Last reply
          0
          • L Luc Pattyn

            :confused: first debugging, now testing. What will you ask for next, documentation?

            Luc Pattyn [Forum Guidelines] [My Articles]


            Voting for dummies? No thanks. X|


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

            Luc Pattyn wrote:

            What will you ask for next, documentation?

            Yes that was my plan. Then I was planning on asking for thinking next. I am trying to ease people into the concept. ;)

            led mike

            1 Reply Last reply
            0
            • N Nandu_77b

              Hi, We have create a C++ DLL. While creating this DLL we have included "string.h" "vector.h" etc and so on... We are able to compile and able to use exported functions in sample program with out any error. We have distributed our DLL with .lib and .h files. He reports that when he includes our .h file in his program, it is not compiling (compile or link errors). He is tell this is boz because it has multiply defines. Is there any way to avoide this? -Nandu

              C Offline
              C Offline
              Cedric Moonen
              wrote on last edited by
              #6

              Nandu_77b wrote:

              We have distributed our DLL with .lib and .h files. He reports that when he includes our .h file in his program, it is not compiling (compile or link errors). He is tell this is boz because it has multiply defines.

              Please post the exact (full) error message because otherwise we will need to guess...

              Cédric Moonen Software developer
              Charting control [v1.4] OpenGL game tutorial in C++

              1 Reply Last reply
              0
              • T toxcct

                probably because he is including your header several times, and because your header is not robust. have you set an exclusive inclusion system in it (like the following) ?

                //header.h

                #pragma once //depending on the compiler. not all support this

                //your header body here...

                //header.h

                #ifndef __HEADER_H_INCLUDED__
                #define __HEADER_H_INCLUDED__

                //your header body here...

                #endif

                [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                N Offline
                N Offline
                Nandu_77b
                wrote on last edited by
                #7

                Hi, Thanks Toxcct, Do i Need to add the below in my header file //header.h #ifndef __HEADER_H_INCLUDED__ #define __HEADER_H_INCLUDED__ //your header body here... #endif OR Who is going to use the DLL should include my header as below? #ifndef __HEADER_H_INCLUDED__ #define __HEADER_H_INCLUDED__ header.h #endif Which is the correct and best approach? -Nandu

                T 1 Reply Last reply
                0
                • T toxcct

                  probably because he is including your header several times, and because your header is not robust. have you set an exclusive inclusion system in it (like the following) ?

                  //header.h

                  #pragma once //depending on the compiler. not all support this

                  //your header body here...

                  //header.h

                  #ifndef __HEADER_H_INCLUDED__
                  #define __HEADER_H_INCLUDED__

                  //your header body here...

                  #endif

                  [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #8

                  TOx back after long time.. great!

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                  Never mind - my own stupidity is the source of every "problem" - Mixture

                  cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/xml>

                  T 1 Reply Last reply
                  0
                  • N Nandu_77b

                    Hi, Thanks Toxcct, Do i Need to add the below in my header file //header.h #ifndef __HEADER_H_INCLUDED__ #define __HEADER_H_INCLUDED__ //your header body here... #endif OR Who is going to use the DLL should include my header as below? #ifndef __HEADER_H_INCLUDED__ #define __HEADER_H_INCLUDED__ header.h #endif Which is the correct and best approach? -Nandu

                    T Offline
                    T Offline
                    toxcct
                    wrote on last edited by
                    #9

                    yes, you put the #ifndef construction in your own header. now, each time the file is included, this stuff prevents the header content to be actually included more than once. check this:

                    yourheader.h


                    src1.h:
                    #include "yourheader.h"
                    //...


                    src1.cpp:
                    #include "src1.h"
                    #include "yourheader.h"
                    //...

                    do you see what happens in src1.cpp ? the user is including his own header (src1.h), and your header (yourheader.h). but the problem is that in src1.cpp, when including yourheader.h, it is already included (by src1.h), thus the "already defined identifier" error. so by putting such a code in your own header, you prevent such an error to occur; if the header is #included several times in the same compilation unit, only the first inclusion will be taken in account...

                    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                    N 1 Reply Last reply
                    0
                    • T ThatsAlok

                      TOx back after long time.. great!

                      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                      Never mind - my own stupidity is the source of every "problem" - Mixture

                      cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/xml>

                      T Offline
                      T Offline
                      toxcct
                      wrote on last edited by
                      #10

                      ;) holidays my friend

                      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                      1 Reply Last reply
                      0
                      • T toxcct

                        yes, you put the #ifndef construction in your own header. now, each time the file is included, this stuff prevents the header content to be actually included more than once. check this:

                        yourheader.h


                        src1.h:
                        #include "yourheader.h"
                        //...


                        src1.cpp:
                        #include "src1.h"
                        #include "yourheader.h"
                        //...

                        do you see what happens in src1.cpp ? the user is including his own header (src1.h), and your header (yourheader.h). but the problem is that in src1.cpp, when including yourheader.h, it is already included (by src1.h), thus the "already defined identifier" error. so by putting such a code in your own header, you prevent such an error to occur; if the header is #included several times in the same compilation unit, only the first inclusion will be taken in account...

                        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                        N Offline
                        N Offline
                        Nandu_77b
                        wrote on last edited by
                        #11

                        The above eplaination gives me clear understanding, Thanks a lot. Just for my clarification, one can include yourheader.h file only in src1.h and no need to include it again in src1.cpp. IS this correct? -Nandu

                        T 1 Reply Last reply
                        0
                        • N Nandu_77b

                          The above eplaination gives me clear understanding, Thanks a lot. Just for my clarification, one can include yourheader.h file only in src1.h and no need to include it again in src1.cpp. IS this correct? -Nandu

                          T Offline
                          T Offline
                          toxcct
                          wrote on last edited by
                          #12

                          yes of course, my example was a bit too fast, but it happens (and i believe that's what happened to you) when you include files that include files that include.... and you can't control exactly what's included anymore...

                          [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                          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