Where to put custom #includes ? How to call device command from GUI?

asked Feb 15, 2018 in System Integration by dschulz1966

Hi there,

in my Build directory i have a myCode.c and myCode.h . myCode.h defines void YourDevice_SayHello();. I changed the Makefile to include the myCode.c file.

Now i added a Button to my GUI that calls a Slot method in Device.mySlot(). All that contains is a call to YourDevice_SayHello();. Of course it is enclosed in !$prototyper and native(){} blocks.

I also added a Inline block with one line: #include "myCode.h"

After building and transferring my project to the target devices (Raspberry Pi) and running make, i get warnings about this:

Compiling ./GeneratedCode/Views.c
Compiling ./GeneratedCode/Application.c
./GeneratedCode/Application.c: In function ‘ApplicationDeviceClass_mySlot’:
./GeneratedCode/Application.c:1037:5: warning: implicit declaration of function ‘YourDevice_SayHello’ [-Wimplicit-function-declaration]
In file included from ./GeneratedCode/Application.c:1087:0:
./myCode.h: At top level:
./myCode.h:3:6: warning: conflicting types for ‘YourDevice_SayHello’
 void YourDevice_SayHello();
./GeneratedCode/Application.c:1037:5: note: previous implicit declaration of ‘YourDevice_SayHello’ was here
Compiling ./GeneratedCode/Templates.c
Compiling ./GeneratedCode/Flat.c

So how to i properly add my header file so that GUI and also custom code is aware of my function definitions?

All that said - the code itself works. The application compiles and correctly outputs "Hello" each time i press the GUI button, so i am presuming all i have to do is to find out where to add my #include myCode.h



1 Answer

0 votes
answered Feb 15, 2018 by dschulz1966
Best answer
In the EW application, i moved the Inline block lower than the Device/DeviceClass blocks. This seems to have solved my issue. I presume the Code Generator will then process the Inline statement (defining function) before the Device/DeviceClass (calling function).
commented Feb 15, 2018 by Paul Banach


Exactly. The order in which the members are numbered in Inspector window does correspond to the order in which the members are converted in code. Please see:

Inline member: Determine the position in the generated code.

Inspector: Reorder members.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint