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
0answers
20 views

Getting error while compiling solidity code using command line and a script

I am following a video tutorial. Here I am trying to compile a solidity code using a JS script and a node comand (node compile.js) But getting following error. Please kindly help. Thanks in advance.
0
votes
1answer
14 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
25 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
31 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
63 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
10 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
149 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
119 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
66 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
35 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
63 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 ...
0
votes
2answers
192 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
215 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
18 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
88 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
62 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
80 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 { ...
1
vote
1answer
445 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
208 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 ...
0
votes
1answer
239 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
777 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
113 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
50 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
838 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
45 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
131 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
461 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
41 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 ...
0
votes
1answer
816 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
31 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
108 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
83 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 ...
0
votes
0answers
128 views

Issue with Using a Struct: InternalCompilerError

The following struct resides in Queue.sol. struct Request { address to; uint256 value; bytes data; } In Unnamed.sol, I have the following pragma solidity ^0.4.14; import "./Queue.sol"; ...
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
0answers
42 views

Need assistance on Altcoin Daemon Setup

I created an altcoin using this Steemit Link I am trying to create a bot on twitter to tip people in my token currency. I am using this github link for the tipbot. I am stuck on the RPC area for my ...
0
votes
1answer
773 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 ...
3
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
324 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
475 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
108 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
488 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
80 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
108 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
456 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
501 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
497 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 ...
1
vote
1answer
215 views

Why was the Solidity compiler removed in geth 1.6.0?

Why was the Solidity compiler removed in geth 1.6.0? What is the procedure to deploy a contract in geth 1.6.0?
1
vote
0answers
151 views

(web3.js) The method eth_compileSolidity does not exist/is not available [duplicate]

I have tried to develop a javascript function with web3.js to compile a solidity contract. In html/javascript code, I have prepared the following. var contract_code = "pragma solidity ^0.4.....[omit ...