Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
Pranavchiku opened this issue Mar 4, 2024 · 3 comments · Fixed by #1691
Closed
2 tasks done

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

Pranavchiku opened this issue Mar 4, 2024 · 3 comments · Fixed by #1691
Assignees
Labels
Bug Something isn't working. C Issue involves or relates to C. Documentation Improvements, additions, or changes to documentation.

Comments

@Pranavchiku
Copy link
Member

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.
@Pranavchiku Pranavchiku added the Bug Something isn't working. label Mar 4, 2024
@kgryte kgryte added C Issue involves or relates to C. Documentation Improvements, additions, or changes to documentation. labels Mar 4, 2024
@kgryte
Copy link
Member

kgryte commented Mar 5, 2024

Related #1712 and #1718

@Pranavchiku
Copy link
Member Author

Can we not set CI to run C examples? But then running all C examples will take a lot of time and computation.

@kgryte
Copy link
Member

kgryte commented Mar 6, 2024

Yes, we've created an internal TODO for this--that is running C examples as part of pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working. C Issue involves or relates to C. Documentation Improvements, additions, or changes to documentation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants