Skip to content
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

error: use of undeclared identifier 'errno' #2810

Closed
yurivict opened this issue Nov 30, 2022 · 4 comments · Fixed by #2811
Closed

error: use of undeclared identifier 'errno' #2810

yurivict opened this issue Nov 30, 2022 · 4 comments · Fixed by #2811

Comments

@yurivict
Copy link

yurivict commented Nov 30, 2022

Build fails on FreeBSD 12.3:

/wrkdirs/usr/ports/science/psi4/work/psi4-0889d6d34/psi4/src/psi4/libpsio/rw.cc:86:33: error: use of undeclared identifier 'errno'
        const int saved_errno = errno;
                                ^
/wrkdirs/usr/ports/science/psi4/work/psi4-0889d6d34/psi4/src/psi4/libpsio/rw.cc:97:33: error: use of undeclared identifier 'errno'
        const int saved_errno = errno;
                                ^
/wrkdirs/usr/ports/science/psi4/work/psi4-0889d6d34/psi4/src/psi4/libpsio/rw.cc:119:37: error: use of undeclared identifier 'errno'
            const int saved_errno = errno;
                                    ^
/wrkdirs/usr/ports/science/psi4/work/psi4-0889d6d34/psi4/src/psi4/libpsio/rw.cc:131:37: error: use of undeclared identifier 'errno'
            const int saved_errno = errno;
                                    ^

It looks like #include <errno.h> is missing.

@JonathonMisiewicz
Copy link
Contributor

Why errno.h rather than cerrno?

@yurivict
Copy link
Author

Because the manpage says so.

@TiborGY
Copy link
Contributor

TiborGY commented Nov 30, 2022

Which manpage? The C++ standard seems to suggest <cerrno>, see https://en.cppreference.com/w/cpp/header/cerrno

@yurivict
Copy link
Author

man errno suggests it, but <cerrno> should also be ok in C++ code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants