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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:35:34+00:00 2026-05-24T17:35:34+00:00

I define a wxObjArray in my TMainFrame.h as follows: #ifndef __TMainFrame__ #define __TMainFrame__ #include

  • 0

I define a wxObjArray in my TMainFrame.h as follows:

#ifndef __TMainFrame__
#define __TMainFrame__

#include "MyApp_gui.h"
//// end generated include

#include "TRunThread.h"

#include <wx/dynarray.h>

class TMove;

WX_DECLARE_OBJARRAY(TMove, TMoveArray);

/* ...Class TMainFrame... */
/* ...Class TMove... */

#endif // __TMainFrame__

Now I want to use the class TMoveArray created by WX_DECLARE_OBJARRAY in my TRunThread.h.
But that class cannot be found (GCC: ‘TMoveArray’ has not been declared)

#ifndef TRUNTHREAD_H_INCLUDED
#define TRUNTHREAD_H_INCLUDED

#include <wx/wx.h>
#include "TMainFrame.h"

// doesn't work: WX_DECLARE_OBJARRAY(TMove, TMoveArray);

class TRunThread : public wxThread
{
  public:
    wxThreadError Create(TMoveArray moves);
};

#endif // TRUNTHREAD_H_INCLUDED

The source file TRunThread.cpp:

#include <wx/arrimpl.cpp> // this is a magic incantation which must be done!
WX_DEFINE_OBJARRAY(TMoveArray);
#include "TRunThread.h"

/* ...Code... */

I’ve also tried with the WX_DEFINE_OBJARRAY directive.

Question: How to include a wxObjArray correctly?

  • 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-24T17:35:35+00:00Added an answer on May 24, 2026 at 5:35 pm

    You are going to need both WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY. The latter goes to an implementation file.

    The reference has a full usage example and more comments.


    And you might also just use std::vector.

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

Sidebar

Related Questions

#define cimg_use_jpeg 2 #ifndef cimg_use_jpeg //code goes here #endif I really don't understand...
I define an array in in the class, not in any method, as a
#define interface class (here is more - http://www.codeproject.com/KB/cpp/CppInterfaces.aspx ) Does that make sense? Does
define_method could be used to define methods: define_method(:m) do |a| end which is equivalent
#define ROW 3 #define COL 4 class Matrix { private: int mat[ROW][COL]; //..... //.....
#define CLASS(ID) class ID{ \ public: \ ID(int) { cout<<#ID <<\tconstructor<<endl; } \ ~ID(){cout<<#ID<<\tDestroyed
define('anActionType', 1); $actionTypes = array(anActionType => 'anActionType'); class core { public $callbacks = array();
(define a 42) (set! 'a 10) (define a 42) (define (symbol) 'a) (set! (symbol)
(define (lcs lst1 lst2) (define (except-last-pair list) (if (pair? (cdr list)) (cons (car list)
I define some Entities which works fine; for meta programming issues. I now need

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.