You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use objc::{class, msg_send};use objc::runtime::{BOOL,Object};fnmain(){println!("Hello, world!");let cls = class!(NSObject);let obj:*mutObject = msg_send![cls, new];let hash:usize = msg_send![obj, hash];let is_kind:BOOL = msg_send![obj, isKindOfClass:cls];// Even void methods must have their return type annotatedlet _:() = msg_send![obj, release];}
The errors are :
error: cannot find macro `sel` in this scope
--> src/main.rs:7:28
|
7 | let obj:*mut Object = msg_send![cls, new];
| ^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot find macro `sel` in this scope
--> src/main.rs:8:23
|
8 | let hash: usize = msg_send![obj, hash];
| ^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `msg_send` (in Nightlybuilds, run with -Z macro-backtrace for more info)
error: cannot find macro `sel` inthis scope
--> src/main.rs:9:25
|
9 | let is_kind:BOOL = msg_send![obj, isKindOfClass:cls];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `msg_send` (in Nightlybuilds, run with -Z macro-backtrace for more info)
error: cannot find macro `sel` inthis scope
--> src/main.rs:11:17
|
11 | let _:() = msg_send![obj, release];
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `msg_send` (in Nightlybuilds, run with -Z macro-backtrace for more info)
error: could not compile `objc-test` due to 4 previous errors
The text was updated successfully, but these errors were encountered:
Thank you very much for the quick answer.
I suppose this should be in the documentation of the base example to avoid such basic question of noobs like me.
The working code in my main.rs is
#[macro_use]externcrate objc;use objc::{class, msg_send};use objc::runtime::{BOOL,Object};fnmain(){println!("Hello, world!");unsafe{let cls = class!(NSObject);let obj:*mutObject = msg_send![cls, new];let hash:usize = msg_send![obj, hash];let is_kind:BOOL = msg_send![obj, isKindOfClass:cls];// Even void methods must have their return type annotatedlet _:() = msg_send![obj, release];println!("{hash}: {is_kind}");}}
The errors are :
The text was updated successfully, but these errors were encountered: