Closed
Description
use objc::{class, msg_send};
use objc::runtime::{BOOL, Object};
fn main() {
println!("Hello, world!");
let cls = class!(NSObject);
let obj: *mut Object = 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 annotated
let _: () = 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 Nightly builds, run with -Z macro-backtrace for more info)
error: cannot find macro `sel` in this 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 Nightly builds, run with -Z macro-backtrace for more info)
error: cannot find macro `sel` in this scope
--> src/main.rs:11:17
|
11 | let _: () = msg_send![obj, release];
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `objc-test` due to 4 previous errors
Metadata
Metadata
Assignees
Labels
No labels