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

Compilation Error with Example #5

Closed
wfairclough opened this issue Feb 28, 2013 · 2 comments
Closed

Compilation Error with Example #5

wfairclough opened this issue Feb 28, 2013 · 2 comments

Comments

@wfairclough
Copy link

I am getting this compilation error with g++. And my main.cpp is the example for this link: http://code.google.com/p/jzon/wiki/WritingFiles

My g++ version output is:

macbook-pro:Jzon v2-0 will$ g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

g++ -Wall -I. jsonWriterMain.cpp Jzon.cpp -o jsonWriter
In file included from jsonWriterMain.cpp:4:
Jzon.h:42: error: expected class-name before ‘{’ token
Jzon.h: In constructor ‘Jzon::TypeException::TypeException()’:
Jzon.h:44: error: expected class-name before ‘(’ token
Jzon.h: At global scope:
Jzon.h:48: error: expected class-name before ‘{’ token
Jzon.h: In constructor ‘Jzon::ValueException::ValueException()’:
Jzon.h:50: error: expected class-name before ‘(’ token
Jzon.h: At global scope:
Jzon.h:54: error: expected class-name before ‘{’ token
Jzon.h: In constructor ‘Jzon::NotFoundException::NotFoundException()’:
Jzon.h:56: error: expected class-name before ‘(’ token
Jzon.h: In member function ‘virtual bool Jzon::Node::Has(const std::string&) const’:
Jzon.h:110: warning: statement has no effect
Jzon.h: In member function ‘virtual Jzon::Node& Jzon::Node::Get(const std::string&) const’:
Jzon.h:112: warning: statement has no effect
Jzon.h: In member function ‘virtual Jzon::Node& Jzon::Node::Get(size_t) const’:
Jzon.h:113: warning: statement has no effect
/usr/include/c++/4.2.1/bits/stl_pair.h: At global scope:
/usr/include/c++/4.2.1/bits/stl_pair.h: In instantiation of ‘std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>’:
Jzon.h:208: instantiated from here
/usr/include/c++/4.2.1/bits/stl_pair.h:84: error: forming reference to reference type ‘Jzon::Node&’
Jzon.h: In member function ‘Jzon::NamedNode Jzon::Object::iterator::operator_()’:
Jzon.h:208: error: no matching function for call to ‘std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>::pair(std::basic_string<char, std::char_traits, std::allocator >&, Jzon::Node&)’
/usr/include/c++/4.2.1/bits/stl_pair.h:80: note: candidates are: std::pair<_T1, _T2>::pair() [with _T1 = std::basic_string<char, std::char_traits, std::allocator >, T2 = Jzon::Node&]
/usr/include/c++/4.2.1/bits/stl_pair.h:69: note: std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>::pair(const std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>&)
Jzon.h: In member function ‘const Jzon::NamedNode Jzon::Object::const_iterator::operator
()’:
Jzon.h:225: error: no matching function for call to ‘std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>::pair(const std::basic_string<char, std::char_traits, std::allocator >&, Jzon::Node&)’
/usr/include/c++/4.2.1/bits/stl_pair.h:80: note: candidates are: std::pair<_T1, _T2>::pair() [with _T1 = std::basic_string<char, std::char_traits, std::allocator >, T2 = Jzon::Node&]
/usr/include/c++/4.2.1/bits/stl_pair.h:69: note: std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>::pair(const std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>&)
In file included from Jzon.cpp:22:
Jzon.h:42: error: expected class-name before ‘{’ token
Jzon.h: In constructor ‘Jzon::TypeException::TypeException()’:
Jzon.h:44: error: expected class-name before ‘(’ token
Jzon.h: At global scope:
Jzon.h:48: error: expected class-name before ‘{’ token
Jzon.h: In constructor ‘Jzon::ValueException::ValueException()’:
Jzon.h:50: error: expected class-name before ‘(’ token
Jzon.h: At global scope:
Jzon.h:54: error: expected class-name before ‘{’ token
Jzon.h: In constructor ‘Jzon::NotFoundException::NotFoundException()’:
Jzon.h:56: error: expected class-name before ‘(’ token
Jzon.h: In member function ‘virtual bool Jzon::Node::Has(const std::string&) const’:
Jzon.h:110: warning: statement has no effect
Jzon.h: In member function ‘virtual Jzon::Node& Jzon::Node::Get(const std::string&) const’:
Jzon.h:112: warning: statement has no effect
Jzon.h: In member function ‘virtual Jzon::Node& Jzon::Node::Get(size_t) const’:
Jzon.h:113: warning: statement has no effect
/usr/include/c++/4.2.1/bits/stl_pair.h: At global scope:
/usr/include/c++/4.2.1/bits/stl_pair.h: In instantiation of ‘std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>’:
Jzon.h:208: instantiated from here
/usr/include/c++/4.2.1/bits/stl_pair.h:84: error: forming reference to reference type ‘Jzon::Node&’
Jzon.h: In member function ‘Jzon::NamedNode Jzon::Object::iterator::operator
()’:
Jzon.h:208: error: no matching function for call to ‘std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>::pair(std::basic_string<char, std::char_traits, std::allocator >&, Jzon::Node&)’
/usr/include/c++/4.2.1/bits/stl_pair.h:80: note: candidates are: std::pair<_T1, _T2>::pair() [with _T1 = std::basic_string<char, std::char_traits, std::allocator >, T2 = Jzon::Node&]
/usr/include/c++/4.2.1/bits/stl_pair.h:69: note: std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>::pair(const std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>&)
Jzon.h: In member function ‘const Jzon::NamedNode Jzon::Object::const_iterator::operator
()’:
Jzon.h:225: error: no matching function for call to ‘std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>::pair(const std::basic_string<char, std::char_traits, std::allocator >&, Jzon::Node&)’
/usr/include/c++/4.2.1/bits/stl_pair.h:80: note: candidates are: std::pair<_T1, _T2>::pair() [with _T1 = std::basic_string<char, std::char_traits, std::allocator >, _T2 = Jzon::Node&]
/usr/include/c++/4.2.1/bits/stl_pair.h:69: note: std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>::pair(const std::pair<std::basic_string<char, std::char_traits, std::allocator >, Jzon::Node&>&)
Jzon.h: In constructor ‘Jzon::Writer::Writer(const Jzon::Node&, const Jzon::Format&)’:
Jzon.h:380: warning: ‘Jzon::Writer::root’ will be initialized after
Jzon.h:378: warning: ‘Jzon::FormatInterpreter* Jzon::Writer::fi’
Jzon.cpp:843: warning: when initialized here
Jzon.h: In constructor ‘Jzon::Writer::Writer(const Jzon::Node&, const std::string&, const Jzon::Format&)’:
Jzon.h:380: warning: ‘Jzon::Writer::root’ will be initialized after
Jzon.h:378: warning: ‘Jzon::FormatInterpreter* Jzon::Writer::fi’
Jzon.cpp:847: warning: when initialized here
Jzon.cpp: In member function ‘bool Jzon::Parser::assemble()’:
Jzon.cpp:1060: warning: enumeration value ‘T_SEPARATOR_NODE’ not handled in switch
Jzon.cpp:1060: warning: enumeration value ‘T_SEPARATOR_NAME’ not handled in switch

@Zguy
Copy link
Owner

Zguy commented Mar 5, 2013

For starters you seem to need this workaround: http://code.google.com/p/jzon/issues/detail?id=8#c6
Can you post the errors that are left after applying the patch?

@Zguy
Copy link
Owner

Zguy commented Jul 8, 2013

The last few commits have fixed a lot of compiler issues. I'm going to assume this problem has been fixed too.

@Zguy Zguy closed this as completed Jul 8, 2013
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

2 participants