I am new in solana smart-contract development and rust. Can anyone help me why i am getting this build time error Could not resolve Accounts symbol Option
when using Optional Account in accounts struct. Any kind of help or info will be really helpful for me.
use anchor_lang::prelude::*;
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod nft_project {
use super::*;
pub fn initialize(_ctx: Context<Initialize>) -> Result<()> {
Ok(())
}
}
#[derive(Accounts)]
pub struct Initialize <'info>{
require_account: Account<'info,MyAccount>,
optional_account: Option<Account<'info,Data>>
}
#[account]
struct MyAccount{
name: String,
}
#[account]
struct Data {
name: String,
age: u8
}