How to use candid-extractor?

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

I ran cargo install candid-extractor in my main terminal ? then I cd to my canister then I ran cargo build then sh script/
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

  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"


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

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


at the end of the file user_canister/

1 Like

solved by adding all the struct to 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/ && 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 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

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