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. weird error... please help

weird error... please help

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comdebuggingquestion
6 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.
  • P Offline
    P Offline
    picazo
    wrote on last edited by
    #1

    Hello, I have a weird error that I hope someone can help me with: I have a program (SDI), whose view is derived from CPropertyView, a property sheet view by Leo Moll. When I run the application in debug mode, I have no problems whatsoever. However, if I change to release mode, I get the following:

    depView.obj : error LNK2001: unresolved external symbol "protected: int __thiscall CDepView::OnCreate(struct tagCREATESTRUCTA *)" (?OnCreate@CDepView@@IAEHPAUtagCREATESTRUCTA@@@Z)
    Release/dep.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    dep.exe - 2 error(s), 0 warning(s)

    In DepView.h, I have: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); In DepView.cpp, I have

    BEGIN_MESSAGE_MAP(CDepView, CPropertyView)
    ON_WM_CREATE()
    ...
    END_MESSAGE_MAP()

    and

    int CDepView::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    ...
    return 0;
    }

    If I remove either the declaration in the header file, or the implementation (and message map) in the source file, it compiles fine, but crashes when I close it (and of course doesnt initialize anything). Does this sound familiar to anyone? I have only seen this error when I forget to include the source file in the project, but I have checked that. What boggles my mind is that it works perfectly in debug mode. Any help/comments would be greatly appreciated, Thanks in advanced, ----------------- Genaro

    S 1 Reply Last reply
    0
    • P picazo

      Hello, I have a weird error that I hope someone can help me with: I have a program (SDI), whose view is derived from CPropertyView, a property sheet view by Leo Moll. When I run the application in debug mode, I have no problems whatsoever. However, if I change to release mode, I get the following:

      depView.obj : error LNK2001: unresolved external symbol "protected: int __thiscall CDepView::OnCreate(struct tagCREATESTRUCTA *)" (?OnCreate@CDepView@@IAEHPAUtagCREATESTRUCTA@@@Z)
      Release/dep.exe : fatal error LNK1120: 1 unresolved externals
      Error executing link.exe.

      dep.exe - 2 error(s), 0 warning(s)

      In DepView.h, I have: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); In DepView.cpp, I have

      BEGIN_MESSAGE_MAP(CDepView, CPropertyView)
      ON_WM_CREATE()
      ...
      END_MESSAGE_MAP()

      and

      int CDepView::OnCreate(LPCREATESTRUCT lpCreateStruct)
      {
      ...
      return 0;
      }

      If I remove either the declaration in the header file, or the implementation (and message map) in the source file, it compiles fine, but crashes when I close it (and of course doesnt initialize anything). Does this sound familiar to anyone? I have only seen this error when I forget to include the source file in the project, but I have checked that. What boggles my mind is that it works perfectly in debug mode. Any help/comments would be greatly appreciated, Thanks in advanced, ----------------- Genaro

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      Just a guess: I'd check the preprocessor definitions for the release build and compare it to that of the debug build. In particular I'd pay attention to the UNICODE, _UNICODE and _MBCS defines. Steve

      P 1 Reply Last reply
      0
      • S Stephen Hewitt

        Just a guess: I'd check the preprocessor definitions for the release build and compare it to that of the debug build. In particular I'd pay attention to the UNICODE, _UNICODE and _MBCS defines. Steve

        P Offline
        P Offline
        picazo
        wrote on last edited by
        #3

        Hi Stephen, thanks for the reply. I checked the preprocessor settings, and as far as definitions are concerned, no difference, except for _debug vs. ndebug. For project options, Debug is:

        /nologo /MDd /W3 /Gm /GX /ZI /Od /I
        "C:\mysql++-1.7.1-win32-vc++\include"
        /I
        "C:\mysql++-1.7.1-win32-vc++\mysql\include"
        /D "WIN32"
        /D "_DEBUG"
        /D "_WINDOWS"
        /D "_AFXDLL"
        /D "_MBCS"
        /Fp"Debug/dep tool.pch"
        /Yu"stdafx.h"
        /Fo"Debug/"
        /Fd"Debug/"
        /FD /GZ /c

        Release is:

        /nologo /MD /W3 /GX /O2 /I
        "C:\mysql++-1.7.1-win32-vc++\include"
        /I
        "C:\mysql++-1.7.1-win32-vc++\mysql\include"
        /D "WIN32"
        /D "NDEBUG"
        /D "_WINDOWS"
        /D "_AFXDLL"
        /D "_MBCS"
        /FR"Release/"
        /Fp"Release/dep tool.pch"
        /Yu"stdafx.h"
        /Fo"Release/"
        /Fd"Release/"
        /FD /c

        I can't find anything that would cause the error there... any clues? ----------------- Genaro

        S D 2 Replies Last reply
        0
        • P picazo

          Hi Stephen, thanks for the reply. I checked the preprocessor settings, and as far as definitions are concerned, no difference, except for _debug vs. ndebug. For project options, Debug is:

          /nologo /MDd /W3 /Gm /GX /ZI /Od /I
          "C:\mysql++-1.7.1-win32-vc++\include"
          /I
          "C:\mysql++-1.7.1-win32-vc++\mysql\include"
          /D "WIN32"
          /D "_DEBUG"
          /D "_WINDOWS"
          /D "_AFXDLL"
          /D "_MBCS"
          /Fp"Debug/dep tool.pch"
          /Yu"stdafx.h"
          /Fo"Debug/"
          /Fd"Debug/"
          /FD /GZ /c

          Release is:

          /nologo /MD /W3 /GX /O2 /I
          "C:\mysql++-1.7.1-win32-vc++\include"
          /I
          "C:\mysql++-1.7.1-win32-vc++\mysql\include"
          /D "WIN32"
          /D "NDEBUG"
          /D "_WINDOWS"
          /D "_AFXDLL"
          /D "_MBCS"
          /FR"Release/"
          /Fp"Release/dep tool.pch"
          /Yu"stdafx.h"
          /Fo"Release/"
          /Fd"Release/"
          /FD /c

          I can't find anything that would cause the error there... any clues? ----------------- Genaro

          S Offline
          S Offline
          Stephen Hewitt
          wrote on last edited by
          #4

          Looks fine. I can't think of anymore suggestions. Good luck Steve

          1 Reply Last reply
          0
          • P picazo

            Hi Stephen, thanks for the reply. I checked the preprocessor settings, and as far as definitions are concerned, no difference, except for _debug vs. ndebug. For project options, Debug is:

            /nologo /MDd /W3 /Gm /GX /ZI /Od /I
            "C:\mysql++-1.7.1-win32-vc++\include"
            /I
            "C:\mysql++-1.7.1-win32-vc++\mysql\include"
            /D "WIN32"
            /D "_DEBUG"
            /D "_WINDOWS"
            /D "_AFXDLL"
            /D "_MBCS"
            /Fp"Debug/dep tool.pch"
            /Yu"stdafx.h"
            /Fo"Debug/"
            /Fd"Debug/"
            /FD /GZ /c

            Release is:

            /nologo /MD /W3 /GX /O2 /I
            "C:\mysql++-1.7.1-win32-vc++\include"
            /I
            "C:\mysql++-1.7.1-win32-vc++\mysql\include"
            /D "WIN32"
            /D "NDEBUG"
            /D "_WINDOWS"
            /D "_AFXDLL"
            /D "_MBCS"
            /FR"Release/"
            /Fp"Release/dep tool.pch"
            /Yu"stdafx.h"
            /Fo"Release/"
            /Fd"Release/"
            /FD /c

            I can't find anything that would cause the error there... any clues? ----------------- Genaro

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            I see at least five differences, which may or may not be the problem. Change the "Relase" values to match the "Debug" values and see if that makes a difference.


            "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

            "There is no death, only a change of worlds." - Native American Proverb

            P 1 Reply Last reply
            0
            • D David Crow

              I see at least five differences, which may or may not be the problem. Change the "Relase" values to match the "Debug" values and see if that makes a difference.


              "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

              "There is no death, only a change of worlds." - Native American Proverb

              P Offline
              P Offline
              picazo
              wrote on last edited by
              #6

              Thank you for you response, I just figured it out a while ago. All I had to do was change the first line of the release options to match the debug options, and it worked. Thanks a lot, ----------------- Genaro

              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