"Undefined Reference" woes
Posted: Wed Oct 04, 2017 10:52 pm
I'm posting this message in the CodeLite forum, because I'm wondering if maybe my problem is CodeLite-related. I don't know.
My goal was to learn how to use the wxWidgets file dialogs. I first compiled the sample program in C:\wxWidgets\samples\dialogs, using an ordinary DOS batch file and the makefile. That program compiled and ran perfectly. I decided I liked the look of the generic Save As dialog, and I'd copy and edit it for my own use. But when I wrote my own program and compiled it in CodeLite, I got the error messages below:
So I figure I'm having trouble getting my wxWidgets program to find C:\wxWidgets\include\wx\generic\filedlgg.h. Here is MainFrame.cpp. I copied the important part (the uncommented-out code in OnSave_as_Button_Clicked) from the example in C:\wxWidgets\samples\dialogs\dialogs.cpp, procedure FileSaveGeneric.
For debugging purposes: my workspace's project, settings, environment variables are:
CodeLiteDir=C:\CodeLite
WXCFG=gcc_lib\mswud
WXWIN=C:\wxWidgets
And I am using:
CodeLite 10.0.7
MinGW hard to tell, but I downloaded it on July 10, 2017
Windows 10 Pro, 64-bit, Test mode
wxWidgets 3.0.2
wxCrafter 2.6
Target platform 32-bit
Target build debug
What do you think? Am I missing something obvious?
Thanks!
Colleen
My goal was to learn how to use the wxWidgets file dialogs. I first compiled the sample program in C:\wxWidgets\samples\dialogs, using an ordinary DOS batch file and the makefile. That program compiled and ran perfectly. I decided I liked the look of the generic Save As dialog, and I'd copy and edit it for my own use. But when I wrote my own program and compiled it in CodeLite, I got the error messages below:
So I figure I'm having trouble getting my wxWidgets program to find C:\wxWidgets\include\wx\generic\filedlgg.h. Here is MainFrame.cpp. I copied the important part (the uncommented-out code in OnSave_as_Button_Clicked) from the example in C:\wxWidgets\samples\dialogs\dialogs.cpp, procedure FileSaveGeneric.
Code: Select all
#include <wx/aboutdlg.h>
#include <wx/generic/filedlgg.h>
#include <wx/file.h>
#include <wx/string.h>
#include <wx/utils.h>
#include "MainFrame.h"
MainFrame::MainFrame(wxWindow* parent)
: MainFrameBaseClass(parent)
{
}
MainFrame::~MainFrame()
{
}
void MainFrame::OnExit(wxCommandEvent& event)
{
wxUnusedVar(event);
Close();
}
void MainFrame::OnAbout(wxCommandEvent& event)
{
wxUnusedVar(event);
wxAboutDialogInfo info;
info.SetCopyright(_("My MainFrame"));
info.SetLicence(_("GPL v2 or later"));
info.SetDescription(_("Short description goes here"));
::wxAboutBox(info);
}
void MainFrame::OnSave_as_Button_Clicked(wxCommandEvent& event)
{
wxString Default_Filename = "";
wxString Default_Path = "F:\\temp\\";
wxString Default_Prompt = "Save the PRM file as";
wxString Default_Wildcard_st = "PRM (Raw Data) Files (*.prm)|*.prm|*.*";
wxString WholeNow = "";
// ----------- USE WXFILEDIALOG TO SET THE DEFAULT PRM FILENAME. -----------
WholeNow = wxNow (); // Get the current time as a string.
Default_Filename = wxString::Format ("%s.prm", WholeNow);
// Let the user choose or create the file via Save As.
wxGenericFileDialog dialog
(this, // parent
Default_Prompt, // message = wxFileSelectorPromptStr,
Default_Path, // defaultDir = wxEmptyString,
Default_Filename, // defaultFile = wxEmptyString,
Default_Wildcard_st, // wildCard = wxFileSelectorDefaultWildcardStr,
wxFD_SAVE|wxFD_OVERWRITE_PROMPT); // style = wxFD_DEFAULT_STYLE,
// pos = wxDefaultPosition,
// sz = wxDefaultSize,
// name = wxFileDialogNameStr,
// bypassGenericImpl = false
dialog.SetFilterIndex(1);
if (dialog.ShowModal() == wxID_OK)
{
wxLogMessage(wxT("%s, filter %d"),
dialog.GetPath().c_str(), dialog.GetFilterIndex());
}
// ...
// Lots of code, deleted for brevity.
// ...
return;
}
CodeLiteDir=C:\CodeLite
WXCFG=gcc_lib\mswud
WXWIN=C:\wxWidgets
And I am using:
CodeLite 10.0.7
MinGW hard to tell, but I downloaded it on July 10, 2017
Windows 10 Pro, 64-bit, Test mode
wxWidgets 3.0.2
wxCrafter 2.6
Target platform 32-bit
Target build debug
What do you think? Am I missing something obvious?
Thanks!
Colleen