Redefinition Errors on Build

Pages: 12
winver.h doesn't seem to be affected by this sequence problem

You do know <winver.h> is automatically included when including <windows.h>, right?

There are other ways to do checks and builds for specific Windows versions.
Win10, MSVS 17.11.3, C++ latest, console app.

I'm a novice, hobbyist coder.

Been there, done and doing that myself. Been self-learning C/C++/Desktop WinAPI for decades. Still chipping away at it all. I know enough to know I have considerable gaps in what is available.

Being a hobbyist novice I suggest a website and two books about C++ to broaden your understanding of the language.

The basics, nearly all of it pre-C++20: https://www.learncpp.com/

The two books:
Beginning C++20: From Novice to Professional
https://link.springer.com/book/10.1007/978-1-4842-5884-2

Beginning C++23: From Beginner to Pro
https://link.springer.com/book/10.1007/978-1-4842-9343-0

I have both book in eBook format (pdf) and find them useful. Especially for learning the intricacies of modules. The printed books are very flimsy and not recommended.

There's an appendix that delve somewhat in depth on headers vs. modules.

There are github repositories for the example code in the books:

https://github.com/Apress/beginning-cpp20 (has the appendix in the repo, it isn't in the eBook)
https://github.com/Apress/beginning-cpp23

+--------+

It appears you are using wxWidgets, correct?

If you are there's a free pdf for how to use the library:

https://wxwidgets.org/docs/book/

No CD with the free version though. :|

There's a github repo for wxWidgets.

https://github.com/wxWidgets

+--------+

FYI, there's a package manager that's cross platform and build system agnostic, vcpkg.

https://vcpkg.io/en/index.html

I use it and it makes 3rd party libraries much easier to acquire, build, integrate, use and update any of the supported libraries. wxWidgets is one of the many supported.

One nice feature for Visual Studio users is integrating the library headers and lib files into the IDE.

https://learn.microsoft.com/en-us/vcpkg/concepts/build-system-integration
@seeplus
Thanks for the tip. I'll look into those macros.

@GeorgePlusPlus
I was not aware of that - include removed.

I'm not checking for Windows versions. As an exercise, I'm extracting data at run-time from a .rc resource file and needed to use the Windows API, which brought me to VerQueryValueA() and GetFileVersionInfo(), and the Win32 API at https://learn.microsoft.com/en-us/windows/win32/api/winver/nf-winver-verqueryvaluea. Note the reference to winver.h.

Thanks for the learning resource recommendations; I'll pursue those. Last book I acquired was Professional C++, 5th ed, 2021, Marc Gregoire. My situation is similar to yours and I've been trying to keep up since the late 80s 🤣.

Not using wxWidgets - I was considering Dear ImGUI https://github.com/ocornut/imgui. In aviation parlance, 'wx' is short for 'weather'.
Last edited on
FYI, ImGui is one of the libraries available with vcpkg.

FYII, when you add a URL to your comment either leave a space at the end or add empty formatting tags at the end. You typed a period and the URL interpreter added at as part of the link. Sometimes it works, most times you get a 404 error.

When I add a link, https://github.com/ocornut/imgui, I use empty teletype tags to keep the URL "clean."

Reference about using tags here at CplusPlus:

https://cplusplus.com/articles/jEywvCM9/
https://cplusplus.com/articles/z13hAqkS/

About the formatting tags to the right of the edit box....you can use them, starting thread or reply. But the Preview feature won't work on opening topic comments until after you submit it. As you have found out. Editing the opening comment and follow-up replies don't have that preview restriction.

This is a bug with the site that has been known for years and likely won't get fixed.

Note the reference to winver.h.

Yes, the function is declared in <winver.h>. Read the Requirements at the bottom of the page and you'll see this:
Header winver.h (include Windows.h)

With the WinAPI always check if a particular header is included in <windows.h>.

<windows.h> is kinda like the WinAPI version of C++23's import std;. One header/module to bring all the other headers/modules together and in the darkness bind them.

+-----+

There's a number of GUI libraries available, as you know. There's the ol' Windows-only WinAPI. Cross-platform there are quite a number. wxWidget is one, ImGUI is another. Saint Bjarne Stroustrup in his college course (and C++ book) uses FLTK.

+-----+

I haven't really played around much with GUI/Image libraries other than the Desktop WinAPI. Maybe I should set aside some time to dink around. Chances are I'd use the SDL2/OpenGL backend combo for cross-platform applicability even though I don't do any cross-platform coding.
Also available if you want to use ImGui with SFML vcpkg has a binding and a DLL available....
George PlusPlus wrote:

Reference about using tags here at CplusPlus

Thanks that really eases my frustration with the site. I've edited the offending posts (for the record 😁).

I don't believe I ever read to the bottom of that MS Docs page. Lesson in TL;DR consequences. That said, why does MS not have this info at the top so that it's immediately obvious and relevant?

I'll add vcpkg to the list of things to investigate. Thanks for nothin'! 😋
Registered users can post here. Sign in or register to post.
Pages: 12