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


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
  • constructor() public { } Commented Apr 10, 2021 at 21:33

2 Answers 2


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.


Encountered the same issue while moving from the old solidity version to the new one. Just had to remove the public keyword after the constructor.

constructor abc() public {
  // your code here.


constructor abc() {
  // your code here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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