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. Multiple Definition error

Multiple Definition error

Scheduled Pinned Locked Moved C / C++ / MFC
c++phpdatabasecomsales
3 Posts 2 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.
  • X Offline
    X Offline
    XTAL256
    wrote on last edited by
    #1

    Hi, there are hundreds of posts on the internet about this but i still don't get it. I am writing a windows program using the g++ compiler and the RAD C++ library[^]. I get these errors:

    WarpFile.o(.text+0x0): In function `ZN11_RADCPP_APP12getBuildTimeEv':
    C:/Program Files/Dev-Cpp/include/radc++.h:2182: multiple definition of `_RADCPP_APP::getBuildTime()'
    Main.o(.text+0x6a0):C:/Program Files/Dev-Cpp/include/radc++.h:2182: first defined here
    WarpFile.o(.text+0x30): In function `ZN11_RADCPP_APP12getBuildDateEv':
    C:/Program Files/Dev-Cpp/include/radc++.h:2181: multiple definition of `_RADCPP_APP::getBuildDate()'
    Main.o(.text+0x6d0):C:/Program Files/Dev-Cpp/include/radc++.h:2181: first defined here
    WarpFile.o(.bss+0x0): In function `ZN11_RADCPP_APP12getBuildTimeEv':
    etc...

    Can someone please look at my code (here[^]) and tell me what i'm doing wrong. Or alternatively explain how i can prevent this error. I know it's because something has been defined in two object files but i don't know how to stop it

    Customer in computer shop: "Can you copy the Internet onto this disk for me?"

    J 1 Reply Last reply
    0
    • X XTAL256

      Hi, there are hundreds of posts on the internet about this but i still don't get it. I am writing a windows program using the g++ compiler and the RAD C++ library[^]. I get these errors:

      WarpFile.o(.text+0x0): In function `ZN11_RADCPP_APP12getBuildTimeEv':
      C:/Program Files/Dev-Cpp/include/radc++.h:2182: multiple definition of `_RADCPP_APP::getBuildTime()'
      Main.o(.text+0x6a0):C:/Program Files/Dev-Cpp/include/radc++.h:2182: first defined here
      WarpFile.o(.text+0x30): In function `ZN11_RADCPP_APP12getBuildDateEv':
      C:/Program Files/Dev-Cpp/include/radc++.h:2181: multiple definition of `_RADCPP_APP::getBuildDate()'
      Main.o(.text+0x6d0):C:/Program Files/Dev-Cpp/include/radc++.h:2181: first defined here
      WarpFile.o(.bss+0x0): In function `ZN11_RADCPP_APP12getBuildTimeEv':
      etc...

      Can someone please look at my code (here[^]) and tell me what i'm doing wrong. Or alternatively explain how i can prevent this error. I know it's because something has been defined in two object files but i don't know how to stop it

      Customer in computer shop: "Can you copy the Internet onto this disk for me?"

      J Offline
      J Offline
      John R Shaw
      wrote on last edited by
      #2

      I can not see the problem in your code, which implies it may be in the header. I could not figure out how to decompress the library download, so I could not look at “regc++.h” to check if it has code guards defined. Try moving the ‘#include “regc++.h”’ from the header file ‘common.h’ and only include it in the files that need it. Beyond that I can not tell why the errors are occurring. Good Luck!

      INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

      X 1 Reply Last reply
      0
      • J John R Shaw

        I can not see the problem in your code, which implies it may be in the header. I could not figure out how to decompress the library download, so I could not look at “regc++.h” to check if it has code guards defined. Try moving the ‘#include “regc++.h”’ from the header file ‘common.h’ and only include it in the files that need it. Beyond that I can not tell why the errors are occurring. Good Luck!

        INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

        X Offline
        X Offline
        XTAL256
        wrote on last edited by
        #3

        Yes, i fiddled around with the code and merged Graphics.cpp with Main.cpp and made a Main.h where i did the same thing. It eventually worked, probably because, like you said, i only included things in the files that needed it. btw, the library is "radc++.h" not "regc++.h" and i just remembered that i downloaded and installed it in Dev-C++. But all you need to know it that it is purely based on Microsoft Window API, no external libraries.

        Customer in computer shop: "Can you copy the Internet onto this disk for me?"

        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