Attempt to fix https://github.com/getlantern/systray/issues/75#92
Merged
joesis merged 1 commit intogetlantern:masterfrom Jun 26, 2019
Merged
Conversation
teddywing
added a commit
to teddywing/systray
that referenced
this pull request
Jul 26, 2019
I was getting this error building on Mac OS X 10.12:
$ pwd
<$GOPATH>/src/github.com/getlantern/systray/example
$ go run .
# github.com/getlantern/systray
systray_darwin.m:132:22: error: use of undeclared identifier 'NSControlStateValueOn'
systray_darwin.m:134:22: error: use of undeclared identifier 'NSControlStateValueOff'
The `NSControlStateValueOn` and `NSControlStateValueOff` were not
defined because Mac OS versions prior to 10.14 don't define
`__MAC_10_14`.
From `/usr/include/Availability.h`:
> It is also possible to use the *_VERSION_MIN_REQUIRED in source code to make one
> source base that can be compiled to target a range of OS versions. It is best
> to not use the _MAC_* and __IPHONE_* macros for comparisons, but rather their values.
> That is because you might get compiled on an old OS that does not define a later
> OS version macro, and in the C preprocessor undefined values evaluate to zero
> in expresssions, which could cause the #if expression to evaluate in an unexpected
> way.
>
> #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
> // code only compiled when targeting Mac OS X and not iPhone
> // note use of 1050 instead of __MAC_10_5
> #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
> // code in here might run on pre-Leopard OS
> #else
> // code here can assume Leopard or later
> #endif
> #endif
See getlantern#75, getlantern#92.
ropog3ovomou
pushed a commit
to ropog3ovomou/systray
that referenced
this pull request
Jul 13, 2022
ropog3ovomou
pushed a commit
to ropog3ovomou/systray
that referenced
this pull request
Jul 13, 2022
I was getting this error building on Mac OS X 10.12:
$ pwd
<$GOPATH>/src/github.com/getlantern/systray/example
$ go run .
# github.com/getlantern/systray
systray_darwin.m:132:22: error: use of undeclared identifier 'NSControlStateValueOn'
systray_darwin.m:134:22: error: use of undeclared identifier 'NSControlStateValueOff'
The `NSControlStateValueOn` and `NSControlStateValueOff` were not
defined because Mac OS versions prior to 10.14 don't define
`__MAC_10_14`.
From `/usr/include/Availability.h`:
> It is also possible to use the *_VERSION_MIN_REQUIRED in source code to make one
> source base that can be compiled to target a range of OS versions. It is best
> to not use the _MAC_* and __IPHONE_* macros for comparisons, but rather their values.
> That is because you might get compiled on an old OS that does not define a later
> OS version macro, and in the C preprocessor undefined values evaluate to zero
> in expresssions, which could cause the #if expression to evaluate in an unexpected
> way.
>
> #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
> // code only compiled when targeting Mac OS X and not iPhone
> // note use of 1050 instead of __MAC_10_5
> #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
> // code in here might run on pre-Leopard OS
> #else
> // code here can assume Leopard or later
> #endif
> #endif
See getlantern#75, getlantern#92.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I think I may have solved issue #75 with a simply macro by updating
systray_darwin.mto this:As I am not an objective C programmer so I am not certain this is a proper fix, but it seems to be working on my end thus far. Let me know if this works for you?