Build fails in release mode

Bryan Kelly 486 Reputation points
2022-07-17T20:36:26.227+00:00

I am far from expert in VS so please be explicit
Windows 11, Visual Studio 2019, C++

Trying to learn wxWidgets. The basic Hello World file compiles in debug but not in release.
The first few lines look like this.
221557-wxwidget-first-few.png
I have tried changing PATH, and the properties pages
221626-widget-properties.png

For example wxprec.h is found here:

C:\WXWIDGETS\3.2.0\include\wx\wxprec.h

Environment variable WXWIN is set to C:\WXWIDGETS\3.2.0

What needs to be different?

Developer technologies C++
{count} votes

20 answers

Sort by: Most helpful
  1. Bryan Kelly 486 Reputation points
    2022-07-22T17:02:40.227+00:00

    Wow. You put a lot of effort into your reply.
    I struggle with clinical depression and have been getting frustrated at my inability to get something working.

    And sometimes when clicking Post Your Answer, a new page opens stating that my request could not be performed. I will watch for that next time, screen capture, and post in the right forum.

    Just wanted to let you know I am working your reply and will post again soon.
    Thank you for your time and thank you for your patience.

    0 comments No comments

  2. Bryan Kelly 486 Reputation points
    2022-07-22T17:05:51.78+00:00

    At the moment I cannot post a comment to an earlier post, so make a reply.

    From the detail instructions posted as an image: DO NOT DO A BATCH BUILD.

    In a thread, I think on a wxWidgets forum, doing a batch build was suggested. At a high level, why do you make this statement?

    And why Win32 rather than x64 or x86? At a relative high level. That means I need to go with a 32 bit application.

    Meanwhile, I am following those instructions.

    Edit

    Step 4) build the solution...

    The almost immediate response in the Output dialog is:

    Build started...

    ==========
    Build: 0 succeeded, 0 failed, 24 up-to-date, 0 skipped ==========

    That indicates, to me, it did not really do a clean. Is this a problem?

    Edit:
    I discovered that the four existing directories (in that wxWidtets lib directory) were created when I did a build. Deleted all four of them and it built as expected.

    8) Go into the project property sheet Configuration Properties -> Linker -> System. Make sure you have select “All Configurations” and “All Platforms” from the dropdowns and change the SubSystem property to "/SUBSYSTEM:WINDOWS”

    I don’t find the “All Configurations” or “All Platforms”
    I did change SubSystem as noted.
    Am I OK?


  3. Bryan Kelly 486 Reputation points
    2022-07-22T19:27:43.557+00:00

    Got it. Have some priorities but will be working it.
    Thank you profusely.
    EDIT
    My Property Manager looks a bit different from yours in that it does not have the sub-item named wsWidgets Setup Options in each of the four categories. An image is attached.
    223924-22jul2022-different-property-manager.png

    I don't know if this will be a problem.


  4. Bryan Kelly 486 Reputation points
    2022-07-23T00:45:52.02+00:00

    I get down to step 12 where it compiles good but does not link I did edit PATH to no avail.
    Then I returned to the wxWidgets, used the batch build to build everything, then added all the new libraries into PATH.
    The results are exactly the same. That puzzles me.

    But as has been seen, posting complex information has proven to be a problem here, I posted the files to a personal web site.
    https://mbkelly.net/software/

    I copied the instructions into a MS Word document along with comments as I progressed. That file was saved as a MS Word document and as an htm document. The htm is exported Word document and does not show the images. Edit: fixed that little problem.
    The first few and last few lines of dialog Output are shown in both formats.

    and for here, the first few lines of Output:

    Build started...
    1>------ Build started: Project: hello_world_10, Configuration: Release Win32 ------
    1>hello_world_10.cpp
    1>hello_world_10.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class wxString __cdecl wxString::FormatV(class wxString const &,char *)" (__imp_?FormatV@wxString@@SA?AV1@ABV1@Pawel @Z)
    1>hello_world_10.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class wxString __cdecl wxString::FromAscii(char const *)" (__imp_?FromAscii@wxString@@SA?AV1@PBD@Z)

    There are 475 errors so obviously a configuration problem. I am reviewing but don't yet see my omission.


  5. Bryan Kelly 486 Reputation points
    2022-07-23T15:34:19.067+00:00

    I followed your instructions instruction precisely. I think I did it right.
    I did purge those directories from wxWidget lib directory and did the single debug build for the wxwidgets.
    Then built hello world 32 bit debug.
    When things did not work out well, I tried to be a thinking person and built wxwidgets for everything and tried different versions.
    Just now I set Debug and x86, then visited Property Pages and changed it to be specifically Debug and Win32.
    I have written all the instructions down and if I errored, will make changes and do it again.
    I know I am testing your patience and am deeply appreciative of your time and knowledge.
    Hopefully this will post with the image.
    223949-23jul-01.png

    Edit: Its a linking error, so added in the widgets lib directory, clean, rebuild.
    No help so added in each of the widget libs and again clean, rebuild. no help.

    223968-23jul-02.png

    And the last attempt was to return to property pages, set All Configurations and All Platforms, same results.


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.