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 7794871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:54:10+00:00 2026-06-01T22:54:10+00:00

I have the following code and i am programming in c++ :- I followed

  • 0

I have the following code and i am programming in c++ :-
I followed the instructions given here by the members and changed the code as :-

 #include <iostream>
 #include <cstdlib>
 #include <cstdio>
 #include <wx/thread.h>
 #include <wx/log.h>
 #include <wx/app.h>

 using namespace std;


 class MyThread;

 class MyThread : public wxThread {
 public:

 MyThread(unsigned int& c);

 virtual ~MyThread();

 wxThreadError Create(unsigned int stackSize = 0);
 wxThreadError Run();
 wxThreadError Delete(ExitCode* rc = NULL, wxThreadWait waitMode =    
 wxTHREAD_WAIT_BLOCK);
 virtual ExitCode Entry();

 private:

 unsigned int& counter;
 };
 MyThread::MyThread(unsigned int& c)
 {
 counter = c;
 }
 MyThread::~MyThread()
 {

 }

 wxThread::ExitCode MyThread::Entry()
 {
 while(counter < 0xFFFFFFFF)
    ++counter;
 return 0;

 }
 int main(int argc, char** argv) {
 unsigned int uiCounter = 0;

 MyThread *mt = new MyThread(unsigned int&);
 if (mt) {
     if (mt->MyThread::Create() == wxTHREAD_NO_ERROR) {
        if (mt->MyThread::Run() == wxTHREAD_NO_ERROR) {

        }
    }
    mt->Delete();
 }
 char cChar = ' ';
 while (cChar != 'q') {
    cout << uiCounter<< endl;
    cChar = (char) getchar();
  }
 return 0;
  }

And have faced the dollowing errors now

 newmain.cpp: In constructor 'MyThread::MyThread(unsigned int&)':
 newmain.cpp:38:1: error: uninitialized reference member 'MyThread::counter' [-   
 fpermissive]

 newmain.cpp: In function 'int main(int, char**)':
 newmain.cpp:57:33: error: expected primary-expression before 'unsigned'

In this problem what i am doing is that i have got two threads one is the main() and other one i have derived from wxthread

  • 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-06-01T22:54:12+00:00Added an answer on June 1, 2026 at 10:54 pm

    The compiler messages tell you how to remove the errors. Start at the top and tackle them one by one.

    newmain.cpp:23:25: error: 'Entry' declared as a 'virtual' field
    

    so the error is in this line

    virtual void *Entry(LPVOID param);
    

    Take a look at the definition of wxThread::Entry() which can be found here http://docs.wxwidgets.org/2.8/wx_wxthread.html#wxthreadentry

    You will see immediately that the base method has a return value and no parameters. The function you create to override the base method must do the same.

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

Sidebar

Related Questions

i have following code in visual c++ #include<Windows.h> LPCTSTR Caption=LApplication programming INTERFACE; INT WINAPI
i have following code from graph theory topics,kruskal algorithm for minimal spanning tree #include<iostream>
I have the following code: #include <iostream> #include <string> #include <unistd.h> using namespace std;
I have following code: public static void ProcessStep(Action action) { //do something here if
I am going through Programming from ground up. Now I have the following code,
I have the following code regarding asynchronous sockets programming: public void ServerBeginAceept(ushort ServerPort) {
I am novice in sharepoint programming. I have a following code: SPWorkflowTask task =
I have following code in my application: // to set tip - photo in
I have following code in my Application. Comments in my code will specify My
I have following code in my application. [self.navigationController pushViewController:x animated:YES]; It will push a

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.