Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [compiler]

The tag has no usage guidance.

0
votes
1answer
23 views

I build solc from source v0.4.18 but can't not use it to compile solidity. How can I solve this problem?

$ solc --bin -o ./contracts SimpleStore.sol Warning: This is a pre-release compiler version, please do not use it in product ...
1
vote
1answer
56 views

Nested structs that are part of a mapping broken in Solidity 0.5.0?

The following code compiled successfully with Soldity 0.4.21. With 0.5.0 it triggers a fatal compilation error as follows: UnimplementedFeatureError: Encoding type "struct TestNestedStructInMapping....
0
votes
1answer
15 views

Is it safe to call revert() instead of returning a value?

I have the following piece of code: function func() public returns (bool) { if (some condition on msg.sender) { do some stuff return true; } revert(); } The compiler (0.4....
2
votes
2answers
20 views

Can I count on this general pattern executing correctly (similarly to C, C++ and probably any other language)?

Suppose I have something like this: contract MyToken is ERC20 { MyTokenImpl private myTokenImpl; constructor(MyTokenImpl _myTokenImpl) public { myTokenImpl = _myTokenImpl; } ...
0
votes
1answer
28 views

Deploying fails with different compile version

I'm trying to implement a simple card game. Actually, everything is working fine. Until I tried to move from 0.4.0 to 0.4.22. Any idea what is going wrong? Thanks a lot. And here the code: pragma ...
0
votes
1answer
26 views

Why is there a difference between a public array and a function which returns it?

On-chain example: pragma solidity 0.4.24; contract MyContract { uint[] public array; constructor() public { array.push(1); array.push(2); array.push(3); } ...
2
votes
1answer
35 views

How to get the correct line numbers from `solc --ast-json`?

I have the following in a file: contract Coin { address public minter; mapping (address => uint) public balances; event Sent(address from, address to, uint amount); function Coin() ...
2
votes
1answer
33 views

Why solc does not detect issue in this code?

I wrote a sample Solidity code below: in function call() of contract sample_call, I make a call to function add_car() function of another contract sample, but this is a bug, since variable v is never ...
0
votes
1answer
109 views

Remix IDE nolonger loads old solidity compilers. Error: "mock compiler: source not found|

The Ethereum solidity Remix IDE doesn't work for some reason. It doesn't seem to load the various compiler versions and renders the error: mock compiler: source not found I've tried to install ...
2
votes
0answers
11 views

What is the compiler version of a contract created by internal transaction? [duplicate]

I want to be able to verify and publish a contract source code on Etherscan.io. I have created a new contract from a factory contract, in which I successfully published and verified. When I come to ...
1
vote
1answer
259 views

Do modifiers work in interfaces

Can an interface enforce a modifier on a function? For example, does this work: contract TokenSeller { modifer enforceSale(uint256 amount) { ERC20 t = token(); uint256 beforeBalance = t....
0
votes
3answers
147 views

Stack too deep compiler error, but function only has 5 parameters?

I have a function, shown in its entirety below, that is getting the dreaded "stack too deep" compiler error. I have read several of the other posts on this forum about this error, but all of them ...
3
votes
0answers
72 views

Why does this work with Solidity 0.4.21 but not 0.4.22?

I have this simple set of contracts. pragma solidity ^0.4.21; contract FirstContract { bool public isTrue = true; function sayHello() public pure returns(bool) { return true; } } ...
0
votes
2answers
45 views

How smart contract versioning work with compiler?

As Solidity is keep updating and so the compiler. In the beginning there was constant keyword which now is deprecated. So how does that smart contract is still working? If i make some contract with ^0....
0
votes
2answers
71 views

My contract doesnt get published on ropsten etherscan

I get the following error: Error! Unable to generate Contract ByteCode and ABI I've seen other people experiencing the same issue but their solutions don't work for my issue. I don't use libraries ...
1
vote
2answers
300 views

Solidity Compiler - Error: Identifier already declared

Full source code of the file 'Test.sol' : pragma solidity ^0.4.23; contract Mortal{ address owner; string ownerInfo = "Contract Owner name XYZ"; constructor () public { owner =...
1
vote
2answers
368 views

Solidity: Best practices - Which compiler version should I use? Advantages / Disadvantages

Where is the main difference between: pragma solidity ^0.4.24; and pragma solidity 0.4.24; Why would I use one or the other? Advantages / Disadvantages? What effect will it have in the future when ...
0
votes
0answers
19 views

Does the solC compiler work in the geth Javascript console anymore

does the solC compiler work in the javascript console anymore, and if it does how can I install it. I have tried using the compiler methods in the javascript console api however they do not work and ...
0
votes
1answer
108 views

The contract will not compile: Member not found or not visible [closed]

This is my code: pragma solidity ^0.4.23; import "./SafeMath.sol"; import "./MintableToken.sol"; import "./Ownable.sol"; import "./BurnableToken.sol"; /** * @title Crowdsale * @dev Crowdsale is a ...
0
votes
2answers
77 views

How do I find out what compiler version was used to deploy with MyEtherWallet

If I deploy a contract on MyEtherWallet.com how can I find out what compiler version was used, for verifying the code on etherscan, etc.?
2
votes
3answers
92 views

ParseError in solidity code

This is the error i get. ParserError: Expected pragma, import directive or contract/interface/library definition. This is my Solidity contract code. pragma solidity ^0.4.6 contract Inbox { ...
2
votes
1answer
674 views

Solved: How to change Solidity linter [solc] compiler version in Visual Studio Code?

Hi may I know how to change my Solidity linter compiler version in Visual Studio Code(vscode)? OR Visual studio code how to specify solidity compiler version? The only Solidity related extensions I ...
8
votes
2answers
4k views

I've got an error while compiling.Use “constructor(…) { … }” instead

I've followed the lecture on Udemy. But I've got an error here's my 'Inbox/contracts/Inbox.sol' pragma solidity ^0.4.17; contract Inbox { string public message; function Inbox(string ...
1
vote
2answers
259 views

Solidity Help - Undeclared Identifier - onlyOwner WithdrawEther

I'm new to Solidity and attempting to add a withdraw ether function for my contract which enables me to release funds the parent contract account, but the compiler (remix) keeps on giving me an ...
1
vote
1answer
304 views

Where is the compiler in Remix?

I installed remix-ide. It is able to compile contracts. So it somehow calls Solidity compiler. Where is this compiler located in the filesystem and how to use it without remix-ide?
1
vote
1answer
962 views

Remix compiler is not loading and gives “Compiler not yet loaded.” message when attempting to force

This issue is occurring on both chrome and firefox. I have not changed anything from a week ago when it worked fine. The remix compiler works on Edge browser but not the other 2. If anyone has any ...
1
vote
1answer
144 views

What is auxdata in the asm output from solc?

I am using - solc --asm smartcontractname.sol I get at the end of the asm auxdata. I am trying to check different modules to see what is inherited. Does anyone know how auxdata is computed? Here is ...
4
votes
0answers
53 views

What is the keccak256 reference in opcodes from solc? [duplicate]

Opcodes - Opcodes: PUSH1 0x60 PUSH1 0x40 MSTORE CALLVALUE ISZERO PUSH1 0xE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0xA0 DUP1 PUSH2 0x1C PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x60 ...
0
votes
1answer
1k views

Solidity: ParserError: Expected pragma, import directive or contract/interface/library definition. uint private age; ^

I am using Atom together with etheratom and I don't get why this simple code won't run: pragma solidity ^0.4.19 contract MyFirstContract { string private name; uint private age; ...
2
votes
1answer
55 views

Examples of functions limitations?

I coded different functions and didn't find a standard that define crystal clear how many variables you can use (fields, local or as parameters of modifiers inside this function? Do you know a ...
0
votes
2answers
150 views

Car Rental System Compile Error

I am writing code for a car rental system but i'm getting a few compile error messages that don't understand. The first error is TypeError: Expression has to be an lvalue. The second is ...
1
vote
0answers
491 views

Solidity Compile error: Identifier already declared

I'm trying to run my code but i get this error: Could not compile source code. " Identifier already declared. function addCar(string _make, string _model, unit _pricePerDay, uint _minRentalDay, ...
0
votes
0answers
51 views

Compiler allows local variable use, before it has been initialized

Hey I noticed that Solidity allows the use of a variable before it has been initialized. The variable is recognized as 0 in the case of a uint. What is the purpose of this design? contract ...
2
votes
1answer
862 views

How to call & use ERC20 airdrop smartcontract

I'm using remix solidity browser compiler. I deployed this code for an AirDrop smart contract: https://pastebin.com/kzYxmEab I used the same address to create/deploy the Airdrop contract as was used ...
3
votes
3answers
2k views

“Mock compiler : Source not found” Error in Remix online IDE

I haven't been able to compile any solidity code because of this error. How do I solve this problem?
0
votes
1answer
43 views

Compiling with outdated compiler

In my contracts I've been placing pragma solidity ^0.4.2; Without knowing my compiler is outdated at 0.4.16! Interestingly, all contracts still compile and are able to migrate to testrpc. Still, I ...
0
votes
1answer
130 views

Ethereum Wallet cannot complie “msg.sender.send”

I have been using Ethereum Wallet to compile and deploy contracts. Now I got this error when trying to test the code in CryptoKittyCore. It failed to compile with this message Failure condition of '...
1
vote
0answers
86 views

EVM Assembly tags

Studying the Solidity optimizer i found that the assembly code is divided into tags and the optimizer doesn't work between them From Solidity docs Optimizer Internals: It splits the sequence of ...
2
votes
2answers
1k views

unable to verify the contract on etherscan.io. How to resolve this issue?

I am unable to verify the contract in etherscan.io. I was able to deploy the same solidity code in (Geth, Mist). But the same code I am unable to verify in etherscan.io. What mistake am I doing here? ...
0
votes
1answer
851 views

Can't compile contract - pragma error and Cannot read property 'interface' of undefined

I am trying to compile this simple contract: pragma solidity ^0.4.18; contract Tasks { struct TaskOwner { address TaskOwnerAddress; bytes32 TaskOwnerName; } mapping (address ...
4
votes
2answers
3k views

Remix Warning - No visibility specified, Violate Checks-Effects-Interaction pattern, Function state mutability can be restricted to pure - Can ignore?

Two months ago, I wrote a smart contract with Remix.ethereum.org. Line 1 of my code has: pragma solidity ^0.4.11; It compiled fine with no errors and nor warnings. I tested every function in ...
0
votes
1answer
351 views

How to execute web3 batch js file

New to solidity programming and I discovered this today at this site: var contract = new web3.eth.Contract(abi, address); var batch = new web3.BatchRequest(); batch.add(web3.eth.getBalance.request('...
4
votes
2answers
515 views

totalSupply() Solidity signature causing conflict error

I'm writing a very basic ERC20 token using solidity in the Mist wallet. For some reason the compiler doesn't like the totalSupply() function name. If I change this name it compiles fine. To be ERC20 ...
0
votes
1answer
121 views

In Node.js connected to Geth : solc.compile prefixes an additional ':' before contractName

I'm trying the following script on Node.js while running a node connected to Rinkeby Testnet (from https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcontract): const fs = require("fs"); ...
3
votes
0answers
501 views

How to update the Ethereum Wallet Solidity Compiler

I'm using the latest Ethereum Wallet version which is 0.9.0 and I want to update my latest Solidity compiler since it seems that the wallet is using this version 0.4.13+commit.0fb4cb1a.Emscripten....
0
votes
1answer
87 views

error building solidity compiler with `brew upgrade`. build from source?

This is the error message I got after recently running brew upgrade: The command which solc, still outputs: /usr/local/bin/solc Is this a problem? Maybe I should uninstall and reinstall my ...
2
votes
0answers
118 views

Is there a “gas penalty” for using too many asserts in a contract?

I'm at a very puzzling scenario. While using Remix, I noticed that adding a few asserts has caused a significant increase in execution cost (from ~50K to ~59K). And not only did it increase the ...
2
votes
1answer
490 views

Node JS module in Geth is not found

I have installed solC module with command: npm install solc How can I use this module in Geth? When I execute var solc = require("solc") in Geth's console, interpreter throws: Error: Cannot find ...
1
vote
1answer
546 views

Truffle Compile on Windows “Could not find a suitable configuration file” [duplicate]

I am trying to do a simple Truffle Compile on window 10 using git bash but i keep getting "Could not find a suitable configuration file" I have tried "Truffle Compile" after running truffle init. I ...
1
vote
1answer
523 views

Undeclared identifier when compiling with truffle compile

I have this contract and can't figure out where's the problem. Any ideas? (I'm a noob in solidity, just started a few days ago). HelloWorld.sol file: mapping (address => uint) balances; function ...