How to use candid-extractor?

I was following this Automatic Candid Generation in Rust: Exploring the ic_cdk v0.10.0 Update

So,
I ran cargo install candid-extractor in my main terminal ? then I cd to my canister then I ran cargo build then sh script/did.sh
But I got this error

Error: failed to find function export `get_candid_pointer`

Any help please?
My sh file

#!/usr/bin/env bash


function generate_did() {
  local canister=$1
  canister_root="src/$canister"

  cargo build --manifest-path="$canister_root/Cargo.toml" \
      --target wasm32-unknown-unknown \
      --release --package "$canister"

  candid-extractor "target/wasm32-unknown-unknown/release/$canister.wasm" > "$canister_root/$canister.did"
}

CANISTERS=user_canister

for canister in $(echo $CANISTERS | sed "s/,/ /g")
do
    generate_did "$canister"
done

here is a photo of my project tree

Also, it is intersting that echo $canister_root/$canister shows user_canister/user_canister
I also added

ic_cdk_macros::export_candid!();

at the end of the file user_canister/lib.rs

1 Like

solved by adding all the struct to lib.rs and make them public also somthing like

use user::*;
use files::*;
use files_content::*;
use contracts::*;
use friends::*;
use share_files::*;
use std::collections::HashMap;
use queries::*;
use updates::*;
use ic_websocket_cdk::*;
use websocket::*;
[bizkit@archlinux cosmicrafts_icp]$ npm run generate

> cosmicrafts_icp_frontend@0.2.0 generate
> scripts/did.sh && dfx generate && npm run format

    Finished release [optimized] target(s) in 0.05s
Error: failed to find function export `get_candid_pointer`

yeah same issue here, I also tried to add allthe s truct to lib.rs and make it public, but for me it didn’t work

use candid::*;

use std::cell::*;

use serde::*;

use ic_cdk_macros::*;

use ic_websocket_cdk::*;

use canister::*;

Did you also do the
ic_cdk_macros::export_candid!();

on your other rust scripts or just on the lib.rs?
also, I’ve read on David’s blog something about the candid methods that must be removed, how did you manage to do that?