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 in c++11 generated common.hpp #762

Closed
spectre-solutions opened this issue Dec 23, 2022 · 1 comment
Closed

Error in c++11 generated common.hpp #762

spectre-solutions opened this issue Dec 23, 2022 · 1 comment

Comments

@spectre-solutions
Copy link
Contributor

spectre-solutions commented Dec 23, 2022

Hi all.
C++11 generated common/common.hpp don't compile, because it includes stdio.h and contains EOF=6, while stdio.h defines #define EOF (-1).

This is how common.hpp includes stdio.h

In file included from /usr/include/c++/11/cstdio:42,
                 from /usr/include/c++/11/ext/string_conversions.h:43,
                 from /usr/include/c++/11/bits/basic_string.h:6594,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from (...)/include/mavlink/common/common.hpp:10,

Here common.hpp contains EOF=6:

enum class MAV_FTP_ERR
{
    NONE=0, /* None: No error | */
    FAIL=1, /* Fail: Unknown failure | */
    FAILERRNO=2, /* FailErrno: Command failed, Err number sent back in PayloadHeader.data[1].
		This is a file-system error number understood by the server operating system. | */
    INVALIDDATASIZE=3, /* InvalidDataSize: Payload size is invalid | */
    INVALIDSESSION=4, /* InvalidSession: Session is not currently open | */
    NOSESSIONSAVAILABLE=5, /* NoSessionsAvailable: All available sessions are already in use | */
    EOF=6, /* EOF: Offset past end of file for ListDirectory and ReadFile commands | */
    UNKNOWNCOMMAND=7, /* UnknownCommand: Unknown command / opcode | */
    FILEEXISTS=8, /* FileExists: File/directory already exists | */
    FILEPROTECTED=9, /* FileProtected: File/directory is write protected | */
    FILENOTFOUND=10, /* FileNotFound: File/directory not found | */
};

There was an issue in mavlink mavlink/mavlink#1853, but we open issue here as was suggested.

Proposed solution: #761

Thanks

@spectre-solutions
Copy link
Contributor Author

Fix was merged to master (#761)
Close the issue

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

No branches or pull requests

1 participant