[package] not found in the root

As the title suggests, the crate I'm trying to use cannot be found in the root directory. I am trying to run the "cursive" crate from the respective site, "crates.io".
My file hierarchy looks like this,

-->Application (parent folder)
---->src (child folder)
------->main.rs
---->target (child folder)
---->.gitignore
---->Cargo.lock
---->Cargo.toml

this file had not been compiled using the command "cargo new [filename] --bin"

I am currently running Rust version "rustc 1.65.0"

rustc 1.65.0 (897e37553 2022-11-02)

I am using the editor, Visual Studio Code; in here, I have the extension "rust-analyzer"
yet, there appears to be an issue when clicking on its button in the lower left of the program, indicated by a "warning sign",

When I do click it, it runs its version of "cargo build" I presume,

failed to run build scripts Check the server logs for additional info.

when I run cargo build in my ./application/src directory, I get the following panic,

--- stderr
  cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release

furthermore, I get the "warning",

warning: build failed, waiting for other jobs to finish...

yet no other running proceeds.

Within my "cargo.toml" file, the layout stays the same with the addition of the dependency from crates.io

[package]
name = "application"
version = "0.1.0"
edition = "2021"

[dependencies]
cursive = "0.20.0"

Within my main file, I have the following code, above my main function,

use cursive;

which, I am to believe uses the crate from the dependencies specified in the toml file. I have installed the respective "ncurses" library using the MingGW application (as I am a windows user)
Since, I have restarted my system 3 times to no avail

Furthermore, another issue that I believe is related to the "syntax highlighting" extension for Rust on the VSC extension place. Is that I am shown red exclamation marks besides my "imported" crate,

I am also using the "run-code" analyzer from the VSC marketplace. I am running from the terminal,

when I do so, I get the error,

error[E0432]: unresolved import `cursive`
 --> main.rs:1:5
  |
1 | use cursive;
  |     ^^^^^^^ no `cursive` in the root

error: aborting due to previous error

I am presented with this error,

rustc --explain E0432

I have searched the internet, sites like Stackoverflow and Github responses yet none seem to show any avail to my issue (which I know sounds ridiculous as there has to be one somewhere), I was just coming here to look for additional help.

I am running Windows 11 as of 01/12/22

If you wish to see code that relates to this issue, just ask. I will gladly respond if any additional images are needed

(I do have more photos but I cannot upload them here as because I am a new User I am restricted to 1 only)

You have Cargo.toml in the target folder? I don't think that will work by default. It should be next to the src folder

1 Like

Running cargo new --bin check gets me

ls -R check
Cargo.toml	src

check/src:
main.rs

I seem to have made a mistake... That isn't where it is actually stored it is stored outside at application file. I am struggling now, I have consulted the Rust discord server and I am still not finding a solution.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.