I did so but I get compile errors.
I guess I have to use a specific #include "???.h"
- but which?
Code: Select all
task main(){
int a,b=1,c=1,d=1,e=1,f=1,g=1,h=1,i=1,j=1,k=1,l=1,m=1,n=1,o=1,p=1,q=1,r=1,s=1,t=1,u=1,v=1,w=1,x=1,y=1,z=1;
//float a,b=1,c=1,d=1,e=1,f=1,g=1,h=1,i=1,j=1,k=1,l=1,m=1,n=1,o=1,p=1,q=1,r=1,s=1,t=1,u=1,v=1,w=1,x=1,y=1,z=1;
long clock;
int cc;
for (cc=0; cc<1000; ++cc) { // 26000 assignements
a=2;
b*=a;
c*=b;
d*=c;
e/=d;
f*=e;
g*=f;
h*=g;
i/=h;
j*=i;
k*=j;
l*=k;
m/=l;
n*=m;
o*=n;
p*=o;
q/=p;
r*=q;
s*=r;
t*=s;
u/=t;
v*=u;
w*=v;
x*=w;
y/=x;
z*=y;
}
clock=CurrentTick()-FirstTick();
NumOut(0,40, clock); // with int:973; with float: 1051
while (true) {
}
}
# Error: Undefined Identifier CurrentTick
File "C:\DOKUME~1\s3000\LOKALE~1\Temp\temp.nxc" ; line 41, position 20
# clock=CurrentTick(
#----------------------------------------------------------
...
#----------------------------------------------------------
the same it's with the following program
Code: Select all
/*****************************************************************************/
// Display output
char LCDline[]={56,48,40,32,24,16,8,0};
int _cur_x_=0, _cur_y_=56; // cursor home for NXC = upper left = (0,56)
int _tab_width_=24; // tab width by default = 24 = 4* 6-point letter
unsigned long _TEXTSTYLE_ = DRAW_OPT_NORMAL; // text style by default
#define scrclr() { ClearScreen(); _cur_x_=0; _cur_y_=56; }
#define gotoxy( x, y ) { _cur_x_=x; _cur_y_=y; } // move cursor to position
#define curxy( x, y ) { _cur_x_=x; _cur_y_=y; } // move cursor to (alias)
#define curx ( x ) { _cur_x_=x; } // move cursor to x-pos
#define cury ( y ) { _cur_y_=y; } // move cursor to y-pos
#define curhome () { _cur_x_=0; _cur_y_=56; } // move cursor home
#define settabwidth( t ) { _tab_width_ = t; } // redefine tab width
#define settextstyle( t ) { _TEXTSTYLE_ = t; } // redefine text style
//*********************************************
inline string strsplit(string &src, string mark) {
string _sret="";
int p=-1, l;
p=Pos(mark, src);
if (p>=0) {
l=strlen(mark);
_sret= SubStr(src, 0, p);
src=SubStr(src, p+l, strlen(src)-p);
}
return _sret;
}
//*********************************************
string strexch(string src, string ex, string ch) {
string _sst;
_sst=strsplit(src,ex);
if (_sst !="") return (StrCat(_sst,ch,src));
else return("");
}
//*********************************************
void backspace() {
TextOut(_cur_x_, _cur_y_, " ");
if (_cur_x_ >=6) _cur_x_-=6;
else if ((_cur_x_ ==0)&&(_cur_y_ <56)) {_cur_x_=90; _cur_y_ +=8; }
TextOut(_cur_x_, _cur_y_, " ");
}
// printfxy()
// featuring "\i" for writing inverted
//******************************************************************************
#define printfxy( _x_, _y_, _f_, _v_) { \
_cur_y_=_y_; string _s2, _sv; \
_s2=_f_; \
if (Pos("\i",_s2)>=0) { \
_TEXTSTYLE_= DRAW_OPT_INVERT; \
_s2=strexch(_s2,"\i",""); \
} \
int len=0; \
if (Pos("%",_s2)==-1) { _sv=_s2; } \
else { _sv = FormatVal(_s2, _v_); } \
TextOut(_x_, _y_, _sv, _TEXTSTYLE_); \
len=strlen(_sv); \
_cur_x_=_x_+6*(len); \
_TEXTSTYLE_= DRAW_OPT_NORMAL; \
}
// printfEx redefined as printf()
// featuring \n, \t, and "\i" for writing inverted
//******************************************************************************
#define printf(_fmt, _val) { \
int _x=_cur_x_; int _y=_cur_y_; \
string _sf, _s; \
_sf=_fmt; \
while (Pos("\n",_sf)>=0) { \
_s=strsplit(_sf,"\n"); \
while (Pos("\t",_s)>=0) { \
_x=(1+_x/_tab_width_)*_tab_width_; \
_s=strexch(_s, "\t", ""); } \
printfxy( _x, _y, _s, _val); \
_x=0; _y-=8; \
} \
while (Pos("\t",_sf)>=0) { \
_x=(1+_x/_tab_width_)*_tab_width_; \
_sf=strexch(_sf, "\t", ""); } \
if(_x>=96) {_x=0; _y-=8;} \
if(_y<0) {scrclr(); _y=56;} \
printfxy( _x, _y, _sf, _val); \
}
//********************************************************************
task main()
{
printf("\n 4 - %d \n=", 1);
printf("%d \n\n ???", 3);
printf("\n hello, \n%s !!!", "world");
while (1);
}
# Error: Invalid constant expression
File "C:\DOKUME~1\s3000\LOKALE~1\Temp\temp.nxc" ; line 11, position 46
# unsigned long _TEXTSTYLE_ = DRAW_OPT_NORMAL;
#----------------------------------------------------------
# Error: Undefined Identifier Pos
File "C:\DOKUME~1\s3000\LOKALE~1\Temp\temp.nxc" ; line 28, position 8
# p=Pos(
#----------------------------------------------------------
# Error: ';' expected
File "C:\DOKUME~1\s3000\LOKALE~1\Temp\temp.nxc" ; line 28, position 9
# p=Pos(m
#----------------------------------------------------------
# Error: Undefined Identifier strlen
File "C:\DOKUME~1\s3000\LOKALE~1\Temp\temp.nxc" ; line 30, position 11
# l=strlen(
#----------------------------------------------------------
# Error: ';' expected
File "C:\DOKUME~1\s3000\LOKALE~1\Temp\temp.nxc" ; line 30, position 12
# l=strlen(m
#----------------------------------------------------------
# Error: Undefined Identifier strlen
...
include path is :
D:\Akten\Programmierung\NXC\include\test-nxc_include_folder\include
when disabling "ignore include files" everything works fine.
do I have to #include all those billions of single .h files by each and every's single name for each single NXC program?
or shall we use a "import-nxc-defs.h" program file to be included in future?
( I guess most people will always use more or less all of those files, especially those for math, stdio, stdlib, display, all sensors manufactured by Lego and all 3rd parties, motors, tasks, a.s.o., at any time...)