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. #include problems

#include problems

Scheduled Pinned Locked Moved C / C++ / MFC
c++oophelpquestion
5 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.
  • V Offline
    V Offline
    vilmer
    wrote on last edited by
    #1

    Hi everyone, I've some problems including header files. I have 2 classes COne and CTwo, and COne implements CTwo objects, so I put an include CTwo statement in COne.h. Both classes must use some functions declared in a Myheader.h file. Including Myheader in both .cpp or .h files produces linking error, and the same does including Myheader.h in CTwo.h to exploit the inheritance of the include statement. The error is LNK1169: one or more multiply defined symbol founds. Any suggestion?

    C S 2 Replies Last reply
    0
    • V vilmer

      Hi everyone, I've some problems including header files. I have 2 classes COne and CTwo, and COne implements CTwo objects, so I put an include CTwo statement in COne.h. Both classes must use some functions declared in a Myheader.h file. Including Myheader in both .cpp or .h files produces linking error, and the same does including Myheader.h in CTwo.h to exploit the inheritance of the include statement. The error is LNK1169: one or more multiply defined symbol founds. Any suggestion?

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

      Did you put these statements in all of your *.h files : #if !defined YOURFILENAME #define YOURFILENAME //Declaration of your class ... ... ... #endif Replace YOURFILENAME by something unique to every file.

      V 1 Reply Last reply
      0
      • C Cedric Moonen

        Did you put these statements in all of your *.h files : #if !defined YOURFILENAME #define YOURFILENAME //Declaration of your class ... ... ... #endif Replace YOURFILENAME by something unique to every file.

        V Offline
        V Offline
        vilmer
        wrote on last edited by
        #3

        Those statements are set by default by Visual Studio in every class file. I tried also to create a dll file from Myheader, but even if i add that library to my project, the app doesn't recognize the functions of the library. Should I addd a .DEF file?

        1 Reply Last reply
        0
        • V vilmer

          Hi everyone, I've some problems including header files. I have 2 classes COne and CTwo, and COne implements CTwo objects, so I put an include CTwo statement in COne.h. Both classes must use some functions declared in a Myheader.h file. Including Myheader in both .cpp or .h files produces linking error, and the same does including Myheader.h in CTwo.h to exploit the inheritance of the include statement. The error is LNK1169: one or more multiply defined symbol founds. Any suggestion?

          S Offline
          S Offline
          Sreekanth Muralidharan
          wrote on last edited by
          #4

          Hello You should not include Myheader.h in both the files. You can include the Myheader.h in CTwo.h and include CTwo.h in COne.h I hope it would work... Bye, Sreekanth Muralidharan ;)

          V 1 Reply Last reply
          0
          • S Sreekanth Muralidharan

            Hello You should not include Myheader.h in both the files. You can include the Myheader.h in CTwo.h and include CTwo.h in COne.h I hope it would work... Bye, Sreekanth Muralidharan ;)

            V Offline
            V Offline
            vilmer
            wrote on last edited by
            #5

            I've already tried this way, but the result was the same. I solved the problem in another way. Thanks to everyone

            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