Skip to content

BUG: running C examples in develop throws an error #1690

Closed
@Pranavchiku

Description

@Pranavchiku

Description

% make examples-c EXAMPLES_FILTER=".*/math/base/special/min/.*"

Running example: /Users/pranavchiku/repos/stdlib-js/stdlib/lib/node_modules/@stdlib/math/base/special/min/examples/c/example.c
Resolving package path...
Package path: /Users/pranavchiku/repos/stdlib-js/stdlib/lib/node_modules/@stdlib/math/base/special/min
Resolving package manifest...
Successfully resolved package manifest.
Resolving include directories...
Resolving source files...
Resolving libraries...
Resolving library paths...
Compiling example...
/Users/pranavchiku/repos/stdlib-js/stdlib/lib/node_modules/@stdlib/math/base/special/min/src/main.c:56:2: warning: no newline at end of file [-Wnewline-eof]
}
 ^
1 warning generated.
example.c:29:25: error: call to undeclared function 'rand'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        x = ( ( (double)rand() / (double)RAND_MAX ) * 200.0 ) - 100.0;
                        ^
example.c:29:42: error: use of undeclared identifier 'RAND_MAX'
        x = ( ( (double)rand() / (double)RAND_MAX ) * 200.0 ) - 100.0;
                                         ^
example.c:30:42: error: use of undeclared identifier 'RAND_MAX'
        y = ( ( (double)rand() / (double)RAND_MAX ) * 200.0 ) - 100.0;
                                         ^
example.c:34:2: warning: no newline at end of file [-Wnewline-eof]
}
 ^
1 warning and 3 errors generated.
make[1]: *** [example.out] Error 1
Error when attempting to compile example.
ERROR: An error was encountered during execution.

make: *** [examples-c] Error 1
% make examples-c EXAMPLES_FILTER=".*/math/base/special/minabs/.*" 

Running example: /Users/pranavchiku/repos/stdlib-js/stdlib/lib/node_modules/@stdlib/math/base/special/minabs/examples/c/example.c
Resolving package path...
Package path: /Users/pranavchiku/repos/stdlib-js/stdlib/lib/node_modules/@stdlib/math/base/special/minabs
Resolving package manifest...
Successfully resolved package manifest.
Resolving include directories...
Resolving source files...
Resolving libraries...
Resolving library paths...
Compiling example...
/Users/pranavchiku/repos/stdlib-js/stdlib/lib/node_modules/@stdlib/math/base/special/minabs/src/main.c:40:2: warning: no newline at end of file [-Wnewline-eof]
}
 ^
1 warning generated.
/Users/pranavchiku/repos/stdlib-js/stdlib/lib/node_modules/@stdlib/math/base/special/min/src/main.c:56:2: warning: no newline at end of file [-Wnewline-eof]
}
 ^
1 warning generated.
example.c:29:25: error: call to undeclared function 'rand'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        x = ( ( (double)rand() / (double)RAND_MAX ) * 1000.0 ) - 500.0;
                        ^
example.c:29:42: error: use of undeclared identifier 'RAND_MAX'
        x = ( ( (double)rand() / (double)RAND_MAX ) * 1000.0 ) - 500.0;
                                         ^
example.c:30:42: error: use of undeclared identifier 'RAND_MAX'
        y = ( ( (double)rand() / (double)RAND_MAX ) * 1000.0 ) - 500.0;
                                         ^
example.c:34:2: warning: no newline at end of file [-Wnewline-eof]
}
 ^
1 warning and 3 errors generated.
make[1]: *** [example.out] Error 1
Error when attempting to compile example.
ERROR: An error was encountered during execution.

make: *** [examples-c] Error 1

Related Issues

NA.

Questions

No.

Demo

No response

Reproduction

shown above

Expected Results

examples run successfully

Actual Results

examples failed to run

Version

latest develop

Environments

N/A

Browser Version

No response

Node.js / npm Version

No response

Platform

No response

Checklist

  • Read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.

Metadata

Metadata

Assignees

Labels

BugSomething isn't working.CIssue involves or relates to C.DocumentationImprovements, additions, or changes to documentation.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions