2017-11-25 93 views
-4

我已經安裝來自Microsoft的C++ 2015工具,如安裝部分所述。錯誤:無法解析清單造成的:沒有找到'package`部分

我得到這個錯誤:

C:\Users\Mg Sein\Desktop\rust\hello_world>cargo build 
error: failed to parse manifest at `C:\Users\Mg Sein\Desktop\rust\Cargo.toml` 

Caused by: 
    no `package` section found. 

這是項目文件的目錄:

directory of project file

我添加路徑變量cargo

add path variable for cargo

這是Cargo.toml的內容:

[package] 
name = "hello_world" 
version = "0.1.0" 
authors = ["Mg Sein"] 
[dependencies] 
+1

該錯誤消息是關於'... \防鏽\ Cargo.toml',但你只給我們看了'... \鐵鏽\程序hello_world \ Cargo.toml'。 '... \ rust \ Cargo.toml'不應該被需要,也許嘗試刪除(或重命名)它。 – Stefan

+0

我更改名稱,但錯誤仍然存​​在。這是錯誤。導致: 清單 中沒有指定任何目標src/lib.rs,src/main.rs,[lib]節或[[bin]]節必須存在@Stefan –

回答

-1

我從cargo.toml改爲Cargo.toml直接鏽項目文件夾內,改變hello.rsmain.rs直接鏽項目文件夾內。

由此看來,

before renaming file

此,

after renaming file

+0

這似乎在每個級別都錯了。什麼是'hello_world'文件夾現在是什麼?一切都應該在該文件夾內,'rust'聽起來不像一個理智的項目文件夾名稱。您似乎也沒有像上面聲稱的那樣在'hello_world'文件夾中調用'cargo build'。 – Stefan

相關問題