Exactly what is the problem here?

Bryan Kelly 516 Reputation points
2022-07-24T21:11:12.867+00:00

Despite much help, I cannot get a simple wxWidgets "Hello World" project to build. As I view the problem, it compiles then fails the linking process. But I lack the skills to understand the error message and determine what is wrong. There are 474 unresolved external. I have parsed out the first message in the hopes of understanding the error.
Will you, someone, please look at this and identify the actual error. What is the first item that cannot be resolved?

1>hello_world_10.obj : error LNK2019: unresolved external symbol   
"__declspec                           declalration specification ?  
   (  
      dllimport                       import a dll?    
   )   
   void __cdecl wxOnAssert            the dll to import? find in a dll somewhere?  
   (  
      char const *,  
      int,  
      char const *,  
      char const *,  
      char const *  
   )"   
  
   (  
      __imp_?wxOnAssert@@YAXPBDH000@Z  
   )   
referenced in function   
  
"public: __thiscall wxEventFunctorMethod  
   <  
      class wxEventTypeTag  
      <  
         class wxCommandEvent  
      >,  
   class MyFrame,  
   class wxCommandEvent,  
   class MyFrame  
   >  
::  
wxEventFunctorMethod  
   <  
      class wxEventTypeTag  
      <  
         class wxCommandEvent  
      >,  
      class MyFrame,  
      class wxCommandEvent,  
      class MyFrame  
      >  
   (  
      void   
      (  
         __thiscall MyFrame::*  
      )  
      (class wxCommandEvent &  
      ),  
      class MyFrame *  
   )"   
   (  
      ??0?$wxEventFunctorMethod@V?$wxEventTypeTag@VwxCommandEvent@@@@VMyFrame@@VwxCommandEvent@@V2@@@QAE@P8MyFrame@@AEXAAVwxCommandEvent@@@ZPAV1@@Z  
   )  
Developer technologies | C++
{count} votes

Accepted answer
  1. RLWA32 49,636 Reputation points
    2022-07-25T11:19:39.743+00:00

    I also read the response to the question you posted on the wxwidgets forum. The answer is an incorrect guess about your project properties. For example, the wxBryan sample does build for UNICODE. The preprocessor definitions are set as follows -

    224401-unicode.png

    0 comments No comments

6 additional answers

Sort by: Most helpful
  1. RLWA32 49,636 Reputation points
    2022-07-25T07:50:23.057+00:00

    For your hello_world_10 or wxBryan projects open the property page Configuration Properties->Linker->General and check the setting for Additional Library Directories. It should look like this -

    224275-addllibs.png

    Click the down arrow to the right and then select "Edit". Another dialog should open that looks like this -

    224168-addllibs2.png

    Click the "Macros>>" button to expand the dialog. After it expands, you should be able to find the wxwidgets library search path as shown here -

    224197-addllibs3.png

    0 comments No comments

  2. RLWA32 49,636 Reputation points
    2022-07-25T11:10:06.767+00:00

    And here is another diagnostic procedure that you can perform. For your hello_world_10 or wxBryan projects open the property page Configuration Properties->C++->Preprocessor and select the option to preprocess to a file as shown here -

    224319-preprocessopt.png

    Build the project. The build should fail but a file with a .i extension should be created in the Debug folder under your project's folder as shown here -

    224286-preprocessed.png

    Open the .i file in a text editor and search for #pragma comment

    You should find lines in the file that look like this for the wxwidgets lib files -

    224345-pragma.png

    This is how the linker is instructed to find the wxwidgets import libraries.


  3. Bryan Kelly 516 Reputation points
    2022-07-27T04:00:49.14+00:00

    RLWA32-6355 Posted recently: And here is another diagnostic procedure that you can perform. …
    I made that change. It looks exactly as pictured. But, things are worse in that I cannot build the sample code provided and named minimal. It is left in its original directory here:

    C:\WXWIDGETS\3.2.0\samples\minimal  
    

    To the output, I am unsure of the proper location. Looking here:

    C:\WXWIDGETS\3.2.0\samples\minimal\vc_mswud\minimal\minimal.tlog  
    

    CL.command.1.tlog and unsuccessfulbuild are empty with no text.
    Minimal.lastbuildstate contains:

    PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0:  
    Debug|Win32|C:\WXWIDGETS\3.2.0\samples\minimal\|  
    

    Am I looking in the wrong place?

    There is also this error:

    >C:\WXWIDGETS\3.2.0\samples\minimal\minimal.cpp(20,10): fatal error C1083: Cannot open include file: 'wx/wxprec.h': No such file or directory  
    

    I think this demonstrates the core problem, but from my evaluations, it should be found.

    I found a verbose option to set and these lines remain in the Output Panel

    1>VSLANG = 1033
    1>VSSKUEDITION = Professional
    1>windir = C:\WINDOWS
    1>WXWIN = C:\WXWIDGETS\3.1.7
    1>ZES_ENABLE_SYSMAN = 1

    WXWIN is set to C:\WXWIDGETS\3.2.0
    The previous version has since been deleted and the computer restarted many times since.
    I still see that as a problem.


  4. Bryan Kelly 516 Reputation points
    2022-07-29T23:11:32+00:00

    I had several problems that seem to have culminated in this thread.
    https://learn.microsoft.com/en-us/answers/questions/941709/environment-variable-is-wrong-in-vs.html?childToView=948280#answer-948280

    Marking this is resolved.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.