I'm now attempting the 'C' pow() function but wonder where to place the #include statement #include Wouldn't you know it, this post machine wont allow the lt math.h gl symbology
It can't be placed outside the var c = E.compiledC( block as it's not recognized as Javascript, and placing it inside results in this compiler msg:
COMPILER MESSAGE
---------------------------------------------------
out4261837251.cpp:60:1: error: stray '#' in program
[#include](https://forum.espruino.com/search/?q=%23include) <math.h>
^
out4261837251.cpp:60:2: error: 'include' does not name a type
[#include](https://forum.espruino.com/search/?q=%23include) <math.h>
COMPILER MESSAGE
---------------------------------------------------
out1319183279.cpp: In function 'int calc(int)':
out1319183279.cpp:71:26: error: 'pow' was not declared in this scope
float dP = pow(dR,dG);
var cg = E.compiledC(`
// int calc(int)
[#include](https://forum.espruino.com/search/?q=%23include) <math.h>
int calc(int n){
float dR = float(n) / 255.0;
float dP = pow(dR,dG);
var cg = E.compiledC(`
// int calc(int)
#include <math.h>
int calc(int n){
float dR = float(n) / 255.0;
float dP = pow(dR,dG);
Need the insight of someone that's been down this path.
A pow er user ;-)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Sun 2018.08.26
I am attempting to write some simple inline C functions. Was able to get the first snippet 'How do I use it' to compile and run.
http://www.espruino.com/InlineC
I'm now attempting the 'C' pow() function but wonder where to place the #include statement
#include
Wouldn't you know it, this post machine wont allow the lt math.h gl symbology
#include <math.h>
Not under: either
http://www.espruino.com/Compilation
It can't be placed outside the
var c = E.compiledC(
block as it's not recognized as Javascript, and placing it inside results in this compiler msg:Need the insight of someone that's been down this path.
A pow er user ;-)
Thankx