Error in running Examplr project of Teleportation in Q#

Razeen ud-Din / PhD Scholar 0 Reputation points
2024-06-26T16:11:43.7466667+00:00

I am learning Q# language. I am running the Example of "Teleportation_project" https://video2.skills-academy.com/en-us/azure/quantum/user-guide/how-to-work-with-qsharp-projects?tabs=tabid-qsharp%2Ctabid-qsharp-run But when I am running this example I got error. The error comes in the filr PrepareState in which we have a code

-------------------------------------------------------------------------------------------------------------
namespace PrepareBell {

operation PrepareBellPair(left : Qubit, right : Qubit) : Unit is Adj + Ctl {

    H(left);

    CNOT(left, right);

}

}


The error I am getting is that
"entry point not found help: a single callable with the @EntryPoint() attribute must be present if no entry expression is provided(Qsc.EntryPoint.NotFound)". What Can I do that to elemenate the erroe. I debug the code but it also gives the same error. Thank you

Azure Quantum
Azure Quantum
An Azure service that provides quantum computing and optimization solutions.
65 questions
{count} votes

1 answer

Sort by: Most helpful
  1. kobulloc-MSFT 25,731 Reputation points Microsoft Employee
    2024-06-28T18:18:27.19+00:00

    Hello, @Razeen ud-Din / PhD Scholar !

    Why am I getting an @EntryPoint() error in my Q# code?

    The @EntryPoint() attribute tells the Q# compiler where to begin executing the program. In programs with multiple function and operation definitions, the @EntryPoint() can be placed before any of the functions or operations and program flow starts from there and continues sequentially.

    If the @EntryPoint() attribute is not included in your Q# code, then you may get the following error:

    Entry point not found help: a single callable with the @EntryPoint() attribute must be present if no entry expression is provided(Qsc.EntryPoint.NotFound)

    https://video2.skills-academy.com/en-us/azure/quantum/user-guide/program-structure#entrypoint

    User's image

    Additional Reading:


    I hope this has been helpful! Your feedback is important so please take a moment to accept answers.

    If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    User's image

    0 comments No comments