Questions tagged [compiler]

A compiler is a computer program that translates a higher-level programming language into a lower-level language. For example: Solidity is compiled into EVM opcodes.

Filter by
Sorted by
Tagged with
0
votes
1answer
22 views

Error While Compiling In Remix During Tutorial

During a tutorial on my first compile I received this error: :1:1: Parser error: Expected import directive or contract definition. pragma solidity ^0.5.12; ^ What's that about? How do I fix it? I'...
0
votes
0answers
21 views

Contract can't import remote repository locally

I made a compiler script that takes all contracts in folder ./contracts/ and produces a .json for each contract, containing an ABI and Bytecode. This worked fine for a while. However, I added some ...
0
votes
1answer
38 views

VS code Expected identifier, got 'LParen'solc

I keep getting this error/warning on my vscode when I emit events and build constructors. or After a bit of googling I understand it is something about my compiler, since solc <0.4.18 does not ...
3
votes
2answers
62 views

Setting Remix default Compiler Version

Is it possible to set the default Compiler version in Remix? Each time I open Remix, the compiler defaults to version 0.5.0+commit.1d4f565a. However, there is currently up to version 0.5.10 available ...
0
votes
3answers
100 views

How to deploy Library contract separate from the main contract and link it

For deployment I am using remix. When I deploy Hello.sol the compiler typically merges SafeMath.sol as a part of the main contract (Hello.sol) and deploys. This adds up library and main contract's ...
0
votes
2answers
29 views

Solidity code sequence for owner

How can I make my code sequential, meaning I'd like functions to be performed in a certain order. Can I make a function not run able till another is run. An example would be great help.
1
vote
1answer
61 views

Function declared as view, but this expression (potentially) modifies the state requires payable

I'm trying to change the an address data variable to a one, which is selected via a function. Keep getting the below error. Function declared as view, but this expression (potentially) modifies the ...
0
votes
2answers
58 views

Type uint256 is not implicitly convertible to expected type int256

I'm trying to compile the following keep getting an error, even though used this before in second code and its working fine. Simply trying to change the temp to the new temperature set by the user, so ...
0
votes
0answers
30 views

Compile solidity smart contract using compiler version provided in the contract

I have been using solc-js in javascript to compile .sol contracts. However, many old smart contracts use older compiler versions that are specified using pragma in the smart contract source code. How ...
1
vote
0answers
23 views

What is the value range of the parameter optimize-runs when running the solidity compiler?

I would like to know what the allowed value range of the parameter optimize-runs is when running the Solidity compiler. I didn't find the answer in the official document of Solidity.
1
vote
2answers
44 views

Get values from stack when certain Opcode is called

I am currently trying to use genetic algorithms to automatically generate test cases that for ethereum smart contracts similar to https://ieeexplore.ieee.org/abstract/document/7840029>this paper. In ...
0
votes
1answer
63 views

ABIEncoderV2PackedStorage bug, is something to worry about? any info?

I have a simple factory of ERC-20 Tokens, deployed to Rinkeby using remix. When I create contracts with this factory and verify the code in Etherscan (using etherscan API) I am having this warning in ...
0
votes
0answers
137 views

Warning: The compiled contract might be susceptible to ABIEncoderV2PackedStorage (low-severity) Solidity Compiler Bugs

This Etherscan.io gives this warning when compiled contract with solidity compiler version 0.5.5 I am sure that is low severity issue and might not apply to our use-case, but I could not find any ...
0
votes
0answers
37 views

solc command is generating empty .bin files

Firstly, this is not an inheritance problem like in this post I have the following two files ( ManagedWallet.sol & ManagedWalletLookup.sol ) pragma solidity ^0.4.24; contract ...
0
votes
0answers
142 views

Is there a way to download Remix IDE locally and access it from the Terminal (Linux)?

Is there a way to download Remix IDE locally and access it from the Terminal (Linux)? Hi, I think I have read that it should be possible to download Remix IDE and use it offline. In the latest ...
0
votes
1answer
235 views

Unhandled Rejection (Error): invalid string value (arg=“x”, coderType=“string”, value=5)

Using Truffle unbox react to unbox a boilerplate. received the following error from running npm run start Changes: Addition of "memory" parameters in the simpleStorage.sol Changed unit to string in ...
0
votes
1answer
16 views

Understanding the “.send” warning message

Warning: Failure condition of 'send' ignored. Consider using 'transfer' instead. Is this a new compiler warning, and what exactly does it mean?
0
votes
0answers
43 views

Why the same contract has more bytecode size in solidity 0.5 in compare to 0.4.24?

My earlier contract was compatible with solc@0.4.24. Now I am upgrading my contract to make it compatible with solidity 0.5 but it leads to an increase in bytecode size. AFAICT There is no change in ...
0
votes
1answer
67 views

Error in external function parameter defination for an interface

Dear community members, I have come across an error while defining an interface (just using the standard one interface ERC721TokenReceiver) this interface is mentioned in this link https://github....
1
vote
2answers
1k views

Unable to run truffle compile

I want to run truffle compile on my AWS Ubuntu 18.4 server. I'm able to compile the same contracts on my local with no compilation errors but when I tried to run truffle compile on AWS ubuntu server ...
0
votes
1answer
58 views

Problem with wallet.transfer in newer solidity compilers

I read the documentation of the changes on 0.5.0 but I do not know how to get this done with my code snippet. I tried to make the constructor payable but this does not work. Can someone help me. The ...
0
votes
0answers
75 views

Can we eliminate specifying solc compiler version at the beginning of each smart contract.

Is it possible to eliminate specifying the solc compiler version at the beginning of each smart contract. This would help in separating the compiler version from the smart contract, so if the compiler ...
2
votes
1answer
803 views

Switch solc compiler versions

I have solc v0.5.2 on my system, but I have several contracts, that require solc < v0.5, so that I get errors: Error: Source file requires different compiler version What is the best way to run ...
0
votes
1answer
155 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
271 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
188 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
24 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
69 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 ...
2
votes
1answer
437 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
88 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
35 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 ...
1
vote
1answer
412 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
13 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
634 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
244 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
83 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
81 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
115 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
751 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 =...
2
votes
2answers
889 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
43 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
155 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
130 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
153 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
2answers
1k 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 ...
9
votes
2answers
6k 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
489 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
501 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
1k 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
227 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 ...