question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

console.log DeclarationError: Undeclared identifier in Solidity

See original GitHub issue

Issue: console.log is throwing an error in remix. Screenshot 2022-12-06 at 9 38 34 PM

Code :

contract LoanFactory {
    Loan[] loans;

    constructor() {}

    function createLoan() external {
        Loan loan = new Loan(100);
        loans.push(loan);
        console.log(loan);
        address(loan); 
    }
}

Error :

Screenshot 2022-12-06 at 9 36 44 PM

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Aniket-Enggcommented, Dec 8, 2022

As of now, there is no support for complex data types

1reaction
Aniket-Enggcommented, Dec 8, 2022

@SaikrishnaReddy1919 seems loan is a struct variable, that can be reason of error. You can try to log individual property.

Read more comments on GitHub >

github_iconTop Results From Across the Web

console.log DeclarationError: Undeclared identifier. #1833
In chrome it works as expected. It seems to be an issue with my browser (latest firefox). I had several glitches recently, ...
Read more >
DeclarationError: Undeclared identifier - solidity
The code is failing to compile due to the error: browser/Token.sol:73:17: DeclarationError: Undeclared identifier. if (approve(_spender, ...
Read more >
DeclarationError: Undeclared identifier. error in remix
You got this error because the pricefeed is not declared or visible for the function.
Read more >
Truffle compile shows DeclarationError Undeclared identifier
Hey. I have made some changes to truffle metacoin and when I run truffle compile command, I get the following error: Compiling ....
Read more >
ethereum/solidity - Gitter
I just copied a function to a new contract and I get an error after using this function. Message: DeclarationError: Undeclared identifier.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found