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

[OSX 10.7] strndup warning when compiling on lion #4751

Closed
DorpsGek opened this issue Aug 28, 2011 · 1 comment
Closed

[OSX 10.7] strndup warning when compiling on lion #4751

DorpsGek opened this issue Aug 28, 2011 · 1 comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

leecbaker opened the ticket and wrote:

Before Lion / 10.7, Mac OS X didn't include the strndup function (previously a GNU extension to the standard library, now part of POSIX 2008). In 10.7, this function is present. When compiling OpenTTD, multiply-defined function warnings occur in many files while compiling. For example:

[SRC] Compiling viewport.cpp
In file included from /Users/lee/openttd/trunk/src/blitter/factory.hpp:17,
from /Users/lee/openttd/trunk/src/viewport.cpp:39:
/Users/lee/openttd/trunk/src/blitter/../string_func.h:202: warning: redundant redeclaration of ‘char* strndup(const char*, size_t)’ in same scope
/usr/include/string.h:142: warning: previous declaration of ‘char* strndup(const char*, size_t)’

In Apple's /usr/include/string.h, they use the following guard to prevent strndup from being included in earlier versions:

# if __DARWIN_C_LEVEL >= 200809L

I've included a 1 line modification to string_func.h to prevent OpenTTD's implementation from being included. This eliminates the warning when compiling. I have not been able to test the compiled OpenTTD running on Lion due to # 4695.

Attachments

Reported version: trunk
Operating system: Mac OS X


This issue was imported from FlySpray: https://bugs.openttd.org/task/4751
@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 4, 2011

planetmaker closed the ticket.

Reason for closing: Fixed

In r22889. Thanks for the patch.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4751

@DorpsGek DorpsGek closed this as completed Sep 4, 2011
@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant