Instance of an object isn't visible outside the current scope(f. e. OnButton1Click) Topic is solved
Instance of an object isn't visible outside the current scope(f. e. OnButton1Click)
So I'm making an app which i described here: viewtopic.php?f=1&t=46861. I linked both projects but my problem is when i want to use one of the methods on object which i created. I can only use them in the scope where the object where created. I cant use anything for example OnButtonClick because i got compiler error that the object wasn't declared in this scope. So here is my main question; Where i need to create my object to be visible from all places? I tried to create the object and MYSQL variable in OnInit place and also in Frame Constructor but always get the same error. I'am using Win 10, CodeBlock 17.12 and wxWidgets 3.0.4 with wxSmith
Re: Instance of an object isn't visible outside the current scope(f. e. OnButton1Click)
Hi,
Your question is really vague.
Could you post some code and the exact error message?
And also explain in layman terms what you are trying to achieve.
Thank you.
Your question is really vague.
Could you post some code and the exact error message?
And also explain in layman terms what you are trying to achieve.
Thank you.
Re: Instance of an object isn't visible outside the current scope(f. e. OnButton1Click)
Ok, so here is the code:https://pastebin.com/2RwPiFKb
And error message C:\Users\User\Desktop\Shel\GUI\GUIMain.cpp|165|error: 'Sunshine' was not declared in this scope|
I commented hints in code to help you interpret my problem
And error message C:\Users\User\Desktop\Shel\GUI\GUIMain.cpp|165|error: 'Sunshine' was not declared in this scope|
I commented hints in code to help you interpret my problem
Re: Instance of an object isn't visible outside the current scope(f. e. OnButton1Click)
Code: Select all
Shelter Sunshine;
MYSQL* conn;
Code: Select all
#include "C:\Users\User\Desktop\Shel\Console\Shelter.h" //----need to give direct path because otherwise compiler cant see this
#include "C:\Users\User\Desktop\Shel\Console\Shelter.cpp" //----this is weird but without this compiler cant refer to constructor or
Use the source, Luke!