Я пытаюсь научиться использовать Tauri для разработки настольного приложения, но сталкиваюсь со следующей ошибкой на своем Mac Book Pro. Я везде искал исправление или других, у которых возникла эта проблема, но пока никого не нашел. пожалуйста помоги.
error: symbol `_EMBED_INFO_PLIST` is already defined
--> src/main.rs:17:14
|
17 | .run(tauri::generate_context!())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `$crate::embed_info_plist_bytes` which comes from the expansion of the macro `tauri::generate_context` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `sandbox` (bin "sandbox") due to 1 previous error
вот и мой файл main.rs
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}
#[tauri::command]
fn reply(replies: &str) -> String {
format!("Your reply is {}", replies)
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![reply])
.run(tauri::generate_context!())
.expect("Error while running application");
}
Вы вызываете Builder два раза, но его следует вызывать только один раз. Вот что вам нужно сделать:
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}
#[tauri::command]
fn reply(replies: &str) -> String {
format!("Your reply is {}", replies)
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet, reply])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}