Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7186755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:42:00+00:00 2026-05-28T18:42:00+00:00

Short summary : My Qt class crashes at class construction part when calling the

  • 0

Short summary:
My Qt class crashes at class construction part when calling the parent QWidget constructor. Error message shows: “First-chance exception at 0x0048fca9 in MyApplication.exe: 0xC0000005: Access violation reading location 0x00000000.”

Details:
I’m working on a project to add an overlay user interface to the one client, much like what steam has when you press “tab+shift” while game play. The original application is written in visual studio environment without any UI stuff, and I decide to use Qt to do the job.

Since the project is pretty complex to transform to a Qt project with the .pro file, I want to basically use Qt as another library (including the lib and include folder and use it in the project).

It works fine when I write it in C language. The menu show up but it’s simply not clickable. It seems like in order to make the Qt event loop to work, I have to declare my custom widget as a class rather than group of C functions.

I added my Qt class into the project, modify the include and lib folder, generate the Moc file, including it in the project. Everything compiles but when I run the program, it shows the error message. Tracking into the code shows that the constructor fails when it tried to construct QWidget.

I have searched online but most tutorial tells you how to work in Qt Creator or with Visual Studio Addin from scratch.

Solved thanks to Smi:

The problem was that I initialize QApplication later than QWidget gets initialized. Adding QApplication before calling constructor fixed the problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:42:01+00:00Added an answer on May 28, 2026 at 6:42 pm

    One possible reason for QWidget constructor failing is that you have forgot to initialize the QApplication object. The Qt documentation says:

    For any GUI application using Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any given time.

    And also:

    Since the QApplication object does so much initialization, it must be created before any other objects related to the user interface are created.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short summary: When you want to predefine certain instantiations of a class, is it
Short and sweet summary: When changing a class from View -derived to ViewGroup -derived,
Summary Long story short, we've been tasked with gutting the authentication and authorization parts
Short: how does modelbinding pass objects from view to controller? Long: First, based on
here is example data: 10914_Excel Short Summary.xls F:\MassHunter\DATA\10921_PAIN\QuantResults\10921_PAIn.batch.bin 10918_Excel Short Summary.xls 10923_Excel Short Summary.xls
First i will paste my code. public class ZSEEActivity extends TabActivity { private WebView
public static class MyExtensions { /// <summary> /// Finds the missing numbers in a
first a short summery: python ver: 3.1 system: Linux (Ubuntu) I am trying to
I have a performance bottleneck on a DataView.Sort. The code is below. /// <summary>
Short version: I want to trigger the Form_Load() event without making the form visible.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.