Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

doesn't compile (the 2nd)

Help
2004-11-21
2013-04-15
  • Steven Weiss
    Steven Weiss
    2004-11-21

    hi john,
    i'm currently working on an assistant which is a visual studio add-in and lets you easily create event handlers for win32gui lib. i created an add-in project based on c++/atl and collected experience in how to insert text into the vs-editor. that works - but now i wanted to include a dialog and for the dialog i wanted to use win32gui lib. the header of the dialog looks like this:

    #pragma once

    #include <win32gui/window.hpp>

    namespace main {
    using namespace win32::gui;

    struct main_dlg : public wnd_extend<dialog, main_dlg>
    {
    ...
    };
    }  // namespace main

    i linked libwin32gui-vc71-dbg-1_6.lib to the project and the runtime-library is "multithreaded-debug-dll". but all i get are a lot of annoying linker-errors:

    msvcprtd.lib(MSVCP71D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in libwin32gui-vc71-dbg-1_6.lib(signal.obj)
    msvcprtd.lib(MSVCP71D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in libwin32gui-vc71-dbg-1_6.lib(signal.obj)
    msvcprtd.lib(MSVCP71D.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator=(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@ABV01@@Z) already defined in libwin32gui-vc71-dbg-1_6.lib(dialog.obj)
    msvcprtd.lib(MSVCP71D.dll) : error LNK2005: "public: char const * __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) already defined in libwin32gui-vc71-dbg-1_6.lib(signal.obj)
    ....

    and some linker warnings (a total of 79 errors and 79 warnings). do you have an idea how to solve this? i tried rebuild but it didn't help

     
    • John Torjo
      John Torjo
      2004-11-22

      Sorry 'bout that.

      I assume you'd be using a DLL. This would require win32gui to be built as a DLL as well.

      At this time, win32gui can only be linked as a static lib. I have not tested it building and running as a DLL yet. I will allow this, but in the future: 1-2 months from now.

      Anyway, it should not be very difficult to make it work as a DLL - but right now I just don't have time to implement it.

      I would recommend you do this:
      - make it work as an EXE, and test it outside VS.

      This way, it will be useful even if you're using another IDE.

      By the time you finish this, I should have the DLL version up and running, and you could also make it a VS add-in. How does that sound?

      Best,
      John

       
      • Steven Weiss
        Steven Weiss
        2004-11-22

        that's ok. anyway it will take some time because i'm also busy at the moment

        mfg steven

         
        • John Torjo
          John Torjo
          2004-11-22

          Great!

          Also, making an EXE will make it easier for you to test (as opposed to testing an add-in - quite a pain in the behind :))

          Best,
          John