0

In VS Code I get this warning in my contract constructor:

Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.

So I remove the visibility, leaving my constructor as

constructor()

Which removes the warning, but when running

$ truffle migrate --reset

I get this error

SyntaxError: No visibility specified. Did you intend to add "public"? constructor() { ^ (Relevant source part starts here and spans across multiple lines). Compilation failed. See above.

The migration runs fine with the warning

Does anyone know how I can resolve this?

Truffle v5.2.5 (core: 5.2.5)
Node v12.16.3
1
1

It looks like truffle uses a different solidity version than vs code. I'd recommend to specify one version in the code, 0.7 should be good enough.

pragma solidity 0.7.6;

The fix VS Code and Truffle so both use the same version.

Using wildcards only make sense if you are a framework developer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.