Skip to content

Example program fails to build or run on latest Solana version #457

@0xAllan123

Description

@0xAllan123

While testing the token-counter example from the Solana Developer Program, the build fails with the following error:
error[E0433]: failed to resolve: use of undeclared crate or module solana_program
This occurs after updating to Solana CLI v1.18.x and Anchor v0.30.x.

Steps to Reproduce:

  1. Clone the repository
    git clone https://github.com/solana-developers/program-examples.git cd program-examples/token-counter
  2. Build and deploy the program
    anchor build anchor deploy
  3. Observe the error output above.

Expected Behaviour:
The example should compile and deploy successfully without modification.

Actual Behaviour:
The build fails due to an unresolved dependency or outdated import path.

Environment:

  • OS: macOS 14.5 / Ubuntu 22.04
  • Solana CLI: v1.18.3
  • Anchor: v0.30.1
  • Rust: 1.81.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions