Windows 11, VS 2019, C++, wxWidgets 3.2.0
I am a relative novice with VS and don’t understand some restrictions. This is becoming quite embarrassing.
It seems that a variable cannot be declared in an include file without making it a constant. That does not make sense to me. Below is the include file. I am using wxWidgets for the first time, got some starter code, and am trying to make it fit my needs.
// dialog_array.h
// Creates an array of dialogs, eventually
#pragma once
#include <wx/wx.h>
// all the below fails produce the same error message:
// 1>vc_x64_mswud\wx_crypto.exe : fatal error LNK1169: one or more multiply defined symbols found
// None of these names are repeated in the entire solution and project.
// rb = radio_button
const int rb_count = 4;
const int rb_length = 6;
int length_01; // fails
const int length_02 = 10; // fails if const not used
const char rb_01 = 'x'; // fails if "const" not used
const char rb_02[2] = "x"; // fails if "const" not used or not an array,
const char rb_03[rb_count][rb_length] = { "bin", "dec", "hex", "txt" }; // fails if "const" not used
//const char rb_04[rb_count][rb_length]; // fails if "const" not used or not initialized
class dialog_array_c : public wxFrame
{
public:
dialog_array_c(const wxString& title);
void ShowMessage1(wxCommandEvent& event);
void ShowMessage2(wxCommandEvent& event);
void ShowMessage3(wxCommandEvent& event);
void ShowMessage4(wxCommandEvent& event);
};
const int ID_INFO = 1;
const int ID_ERROR = 2;
const int ID_QUESTION = 3;
const int ID_ALERT = 4;
And what tags should be used for this question? The only relevant one I can find is C++.