Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Library "strings" declared twice #6

Open
luren5 opened this issue Dec 21, 2016 · 3 comments
Open

Error: Library "strings" declared twice #6

luren5 opened this issue Dec 21, 2016 · 3 comments

Comments

@luren5
Copy link

luren5 commented Dec 21, 2016

while I imported the library and compiled, it return warning

strings.sol:37:1: Warning: Source file does not specify required compiler version!Consider adding "pragma solidity ^0.4.7
library strings {

then, added the "pragma solidity ^0.4.7" and compiled again, it returns error

[root@localhost contracts]# truffle compile
Compiling ./contracts/Ballot.sol...
Compiling ./contracts/strings.sol...
Compiling strings.sol...
Error compiling:

/home/xuhuan/contract/c2/contracts/strings.sol:39:1: Error: Library "strings" declared twice (will create ambiguities during linking).
library strings {
^
Spanning multiple lines.
The other declaration is here: strings.sol:39:1: 
library strings {
^
Spanning multiple lines.
@Arachnid
Copy link
Owner

Arachnid commented Dec 21, 2016

It sounds like you're including the library more than once, via a relative path and an absolute path. What do your import statements look like?

@llixli
Copy link

llixli commented Apr 12, 2017

I solved this problem using the full path to imported file

@sk4092
Copy link

sk4092 commented Jun 22, 2017

use import './strings.sol'; while importing the library and keep both files in same directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants