mikroC, VisualTFT and variables

General discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
mpavlica
Posts: 161
Joined: 02 Jan 2006 19:18

mikroC, VisualTFT and variables

#1 Post by mpavlica » 22 Nov 2019 20:32

Hello

I am having trouble, and I know that solution is simple, but I just cant see it :)

I just stared a VisualTFT project and when I declare a variable in MAIN.C and generate click event, and software creates a function in _events_code, when i want to use that variable, it cannot being accessed.
My question is, where to declare it to be global, so it can be used everywhere in a software?
Also, on top of main.c i made a "defines.h" where i keep some default integer values for some settings, and even declares from that file are not seen from events_code when compiling.
Thanks!
Milan Pavlica YU7XW

User avatar
jovana.medakovic
mikroElektronika team
Posts: 986
Joined: 18 Dec 2018 10:36

Re: mikroC, VisualTFT and variables

#2 Post by jovana.medakovic » 25 Nov 2019 12:41

Hello,

If you want to see some variable everywhere in the project, you can declare it in the _objects.h file, for example:
extern int var;

I recommend you to look at our VTFT examples from our compiler:
\Mikroelektronika\mikroC PRO for PIC32\Examples\VTFT

Kind regards,
Jovana

mpavlica
Posts: 161
Joined: 02 Jan 2006 19:18

Re: mikroC, VisualTFT and variables

#3 Post by mpavlica » 01 Dec 2019 17:07

I did that before and see attached error. No, it is not re-defined in main.c, there is no more reference to that variable, only in _objects.h
Attachments
Error1.jpg
Error1.jpg (88.71 KiB) Viewed 1030 times
Milan Pavlica YU7XW

Post Reply

Return to “mikroC PRO for PIC32 General”