Home > Back-end >  Excuse me wrong 'strtoq undeclared (first use this function) how to solve
Excuse me wrong 'strtoq undeclared (first use this function) how to solve

Time:10-21

Compiled under ns2.28 ns - aedcf appear the following error

Error:
Misc. Cc: 65: erro: 'strtoq undeclared (first use this function)
Misc. Cc: 65: erro: (Each undeclared identifier is reported only once for Each function it appears in.)

Misc. Cc file code below

# # ifndef lint
The static const char rcsid []=
"@ $Header (#) :/NFS/jade/he/CVSROOT/ns - 2/misc. Cc, 1.10 v 1999/09/28 03:46:31 heideman Exp $(LBL)";
# endif

#include
#include
# # ifndef WIN32
#include
# endif
#include
# include "config. H"
# include "scheduler. H"
# include "random. H"
# define strtoll _strtoi64

# if defined (HAVE_INT64)
The class Add64Command: public TclCommand {
Public:
Add64Command () : TclCommand (" ns - add64 ") {}
Virtual int the command (int arg c, const char * const * argv);
};

Int Add64Command: : command (int arg c, const char * const * argv)
{
Tcl& TCL=TCL: : instance ();
If (arg c==3) {
Char res [22]. A 64 - bit/* int the at most 20 who */
Int64_t d1=STRTOI64 (argv [1], NULL, 0).
Int64_t d2=STRTOI64 (argv [2], NULL, 0).
Sprintf (res, STRTOI64_FMTSTR, d1 and d2);
TCL. Resultf (" % s ", res);
Return (TCL_OK);
}
TCL. Add_error (" ns - add64 requires two arguments. ");
Return (TCL_ERROR);
}
# endif

The class RandomCommand: public TclCommand {
Public:
RandomCommand () : TclCommand (" ns - random ") {}
Virtual int the command (int arg c, const char * const * argv);
};

/*
* ns - random
* ns - random $seed
*/
Int RandomCommand: : command (int arg c, const char * const * argv)
{
Tcl& TCL=TCL: : instance ();
If (arg c==1) {
Sprintf (TCL. Buffer (), "% u", the Random: : Random ());
TCL. Result (TCL. Buffer ());
} else if (arg c==2) {
Int seed=atoi (argv [1]).
If (seed==0)
Seed=Random: : seed_heuristically ();
The else
The Random: : seed (seed);
TCL. Resultf (" % d ", seed);
}
Return (TCL_OK);
}

Extern "C" char version_string [];

The class VersionCommand: public TclCommand {
Public:
VersionCommand () : TclCommand (" ns - version ") {}
Virtual int the command (int, const char * const *) {
Tcl: : instance (). The result (version_string);
Return (TCL_OK);
}
};

The class TimeAtofCommand: public TclCommand {
Public:
TimeAtofCommand () : TclCommand (" time_atof ") {}
Virtual int the command (int arg c, const char * const * argv) {
If (arg c!
=2)Return (TCL_ERROR);
Char * s=(char *) argv [1].
Char WRK [32].
Char * cp=WRK;
While (isdigit (* s) | | * s=='e' | |
* s=='+' | | * s=='-' | | * s=='. ')
* cp++=* s++;
* the cp=0;
A double v=atof (WRK);
The switch (* s) {
Case 'm:
V * e=1-3;
break;
Case 'u' :
V *=1 e - 6;
break;
Case 'n' :
V e *=1-9;
break;
Case: 'p'
1 e - 12 v *=;
break;
}
Tcl: : instance (). Resultf (" % g, v);
Return (TCL_OK);
}
};

Void init_misc (void)
{
(void) new VersionCommand;
(void) new RandomCommand;
(void) new TimeAtofCommand;
# if defined (HAVE_INT64)
(void) new Add64Command;
# endif
}

CodePudding user response:

Errors occur on line this
Int64_t d1=STRTOI64 (argv [1], NULL, 0).

CodePudding user response:

As far as possible with high version compiler to compile,
  • Related