Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: qt6 build issues #981

Open
slspencer opened this issue Jun 19, 2023 · 7 comments
Open

Build: qt6 build issues #981

slspencer opened this issue Jun 19, 2023 · 7 comments

Comments

@slspencer
Copy link
Collaborator

With Qt 6.2, MSVC 2019, and Qt Creator 10.01 on Windows 10 64-bit (Desktop_Qt_6_2_4_MSVC2019_64bit)
The following issues appear during compiling:

  • seamly2d\src\libs\vmisc\vabstractapplication.cpp:283: warning: C4834: discarding return value of function with 'nodiscard' attribute
  • seamly2d\src\libs\vmisc\vabstractapplication.cpp:284: warning: C4834: discarding return value of function with 'nodiscard' attribute
  • seamly2d\src\libs\vmisc\vabstractapplication.cpp:285: warning: C4834: discarding return value of function with 'nodiscard' attribute
  • seamly2d\src\libs\vmisc\vabstractapplication.cpp:292: warning: C4834: discarding return value of function with 'nodiscard' attribute
  • seamly2d\src\libs\vmisc\vabstractapplication.cpp:293: warning: C4834: discarding return value of function with 'nodiscard' attribute
  • seamly2d\src\app\seamly2d\dialogs\export_layout_dialog.cpp:766: warning: C4003: not enough arguments for function-like macro invocation 'QStringLiteral'
  • seamly2d\src\app\seamly2d\dialogs\export_layout_dialog.cpp:766: warning: C4003: not enough arguments for function-like macro invocation 'QT_UNICODE_LITERAL'
  • seamly2d\src\app\seamly2d\dialogs\export_layout_dialog.cpp:88: warning: Definition of implicit copy constructor for 'QException' is deprecated because it has a user-provided destructor
  • seamly2d\src\app\seamly2d\dialogs\export_layout_dialog.cpp:88: In implicit copy constructor for 'QException' first required here
  • seamly2d\src\app\seamly2d\dialogs\export_layout_dialog.cpp:782: warning: Default label in switch which covers all enumeration values
  • seamly2d\src\app\seamly2d\dialogs\export_layout_dialog.cpp:34: warning: Included header options.h is not used directly (fix available)
@DSCaskey
Copy link
Contributor

I just built using pretty much the same... albeit on Windows 11.

I got none of these warnings. ???

Out of all the warnings the only one that makes any sense is the QtStringLiteral()... since it's a actully a MACRO it probably doesn't like the empty arguments.... so it should be QStringLiteral(""). Some warnings don't even make sense... like the default label in the switch.... if there's a problem with that there should be a 100 warnings as most if not all the switch statements have a default: in them. The no discard attibute... it's complaining about a compiler conditional?? and it''s complaining about an unsed header??

That being said... warnings are not the issue with a Qt6 build.

@hr-98
Copy link

hr-98 commented Jun 24, 2023

Can you try it with MSVC 2022? Ci is using that version.

@DSCaskey
Copy link
Contributor

Can you try it with MSVC 2022? Ci is using that version.

Why? These are just warnings. I'm using MSVC 2019 and it builds without the warnings. There are other issues that have nothing to do with MSVC 2022 vs MSVC 2019... neither kit build runs correctly.

@DSCaskey
Copy link
Contributor

DSCaskey commented Jul 3, 2023

I took a closer look at all these:

  • seamly2d\src\libs\vmisc\vabstractapplication.cpp:283: warning: C4834: discarding return value of function with 'nodiscard' attribute
  • seamly2d\src\libs\vmisc\vabstractapplication.cpp:284: warning: C4834: discarding return value of function with 'nodiscard' attribute
  • seamly2d\src\libs\vmisc\vabstractapplication.cpp:285: warning: C4834: discarding return value of function with 'nodiscard' attribute
  • seamly2d\src\libs\vmisc\vabstractapplication.cpp:292: warning: C4834: discarding return value of function with 'nodiscard' attribute
  • seamly2d\src\libs\vmisc\vabstractapplication.cpp:293: warning: C4834: discarding return value of function with 'nodiscard' attribute

nodiscard

I would assume it's complaing about the load() functions which return a bool that are not being checked.

These are legit warnings as it should be calling QStringLiteral("") instead of QStringLiteral()

  • seamly2d\src\app\seamly2d\dialogs\export_layout_dialog.cpp:766: warning: C4003: not enough arguments for function-like macro invocation 'QStringLiteral'
  • seamly2d\src\app\seamly2d\dialogs\export_layout_dialog.cpp:766: warning: C4003: not enough arguments for function-like macro invocation 'QT_UNICODE_LITERAL'

This is also legit... since the base class already has a virtual destructor, no need to redefine one in the subclass - thus it's "deprecated"

  • seamly2d\src\app\seamly2d\dialogs\export_layout_dialog.cpp:88: warning: Definition of implicit copy constructor for 'QException' is deprecated because it has a user-provided destructor

This one is a bit confusing as like I stated before there are mulitple instances of the use of a case followed by default:. This appears to be complaining because it expects the previous case to break, then the default case. Simple solution in this case is to simply remove the default label. Shouldn't be calling the routine with a case that can't be handled anyway... and in the event some other programmer does, they'll get an error meaning they need to fix something.

  • seamly2d\src\app\seamly2d\dialogs\export_layout_dialog.cpp:782: warning: Default label in switch which covers all enumeration values

Again this is one is just pointing out the include can be removed as it's not needed. Which I'm sure theres a lot more than just this unused include.

  • seamly2d\src\app\seamly2d\dialogs\export_layout_dialog.cpp:34: warning: Included header options.h is not used directly (fix available)

I will fix all these.

@slspencer
Copy link
Collaborator Author

@DSCaskey Thanks for looking into these compiler warnings.And please, if you see another set of code fixes like these that would be a good issue for @Esterjudith to work on to become familiar with our code, add it as an issue.

@DSCaskey
Copy link
Contributor

DSCaskey commented Jul 4, 2023

@slspencer I believe I have squashed these warnings, but I'm not sure as I was not getting them in the first place. Were these warnings that you were getting, or someone else? I would need to know what the build environment was that produces these warnings, so I can compare with and without the fixes. BTW... I created a discussion detailing what I used to build with Qt6 here: https://github.com/orgs/FashionFreedom/discussions/996

@DSCaskey
Copy link
Contributor

DSCaskey commented Jul 5, 2023

I was able to trigger the warnings outlined in this issue by setting to the debugger with the MSVC windows kit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants