Basic Doubt with Function
Posted: Sat Aug 10, 2019 7:54 pm
Beginner's Question
I understand that my current question is also somewhat similar to previous ones, but I am asking this question because I am having difficulty understanding what is happening.
Previously I was developing an application and learning from it about wxWidgets. However, I decided to start another one from scratch by doing it differently, so the following problem started!
The Example I started from scratch, just to learn and understand, I'm using Codeblocks + wxSmith.
He automatically created 5 files because he separates everything, but that's good, because it makes it easier for me to understand:
Create_FunctionsApp.cpp
Create_FunctionsApp.h
Create_FunctionsMain.cpp
Create_FunctionsMain.h
Create_Functionsframe.wxs
Situation:
In Create_FunctionsMain.h I declared the function like this:
Below
In Create_FunctionsMain.cpp I put my function below
PROBLEM:
But this same function, already declared I can't call it in: Create_FunctionsApp.cpp
I am completely lost on why this is happening.
Can someone help me?
I understand that my current question is also somewhat similar to previous ones, but I am asking this question because I am having difficulty understanding what is happening.
Previously I was developing an application and learning from it about wxWidgets. However, I decided to start another one from scratch by doing it differently, so the following problem started!
The Example I started from scratch, just to learn and understand, I'm using Codeblocks + wxSmith.
He automatically created 5 files because he separates everything, but that's good, because it makes it easier for me to understand:
Create_FunctionsApp.cpp
Create_FunctionsApp.h
Create_FunctionsMain.cpp
Create_FunctionsMain.h
Create_Functionsframe.wxs
Situation:
In Create_FunctionsMain.h I declared the function like this:
Below
Code: Select all
class Create_FunctionsFrame: public wxFrame {
private:
void Function_Test();
Code: Select all
Create_FunctionsFrame::~Create_FunctionsFrame() {
//(*Destroy(Create_FunctionsFrame)
//*)
}
void Create_FunctionsFrame::Function_Test() {
wxMessageBox("Test OK!");
}
// I call my function from a Form button and it WORKS
void Create_FunctionsFrame::OnAbout(wxCommandEvent & event) {
Function_Test();
}
But this same function, already declared I can't call it in: Create_FunctionsApp.cpp
Code: Select all
#include "Create_FunctionsMain.h" // I informed her where she is declared
bool Create_FunctionsApp::OnInit() {
//(*AppInitialize
bool wxsOK = true;
wxInitAllImageHandlers();
if (wxsOK) {
Create_FunctionsFrame* Frame = new Create_FunctionsFrame(0);
Frame->Show();
SetTopWindow(Frame);
}
//*)
Function_Test(); /// error: ‘Function_Test’ was not declared in this scope
return wxsOK;
}
Can someone help me?