• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ Compiling error

Ancio

Member
Joined
Dec 13, 2014
Messages
25
Reaction score
5
Hello boys.
I've been trying for several days compiling TFS 0.4. I have VPS on Debian 9 system. I follow a lot of tutorials but whenever i got a lot of bugs. Now i Follow this tutorial
and im practically at the end
but i have error:
Code:
talkaction.cpp:233:11: error: no match for ‘operator<<’ (operand types are ‘std::stringstream {aka std::__cxx11::basic_stringstream<char>}’ and ‘std::stringstream {aka std::__cxx11::basic_stringstream<char>}’)
        sl << ss;
        ~~~^~~~~
talkaction.cpp:233:14: error: cannot bind ‘std::basic_ostream<char>’ lvalue to ‘std::basic_ostream<char>&&’
        sl << ss;
              ^~
Here is my talkaction 233:11 Line
C++:
{
                    PlayerCast pc = p->getCast();

                    std::stringstream ss, sl;
                    ss << Player::cSpectators.size() << " Viewers: ";
                    bool first = true;
                    for(AutoList<ProtocolGame>::iterator it = Player::cSpectators.begin(); it != Player::cSpectators.end(); ++it) {
                        if(it->second->getPlayer() == p)
                        {
                            sl.clear();
                            sl << ss;
                            if(first)
                                first = false;
                            else
                                ss << ", ";

                            ss << it->second->getViewerName();
                            if(ss.str().length() > 250)
                            {
                                ss.clear();
                                ss << sl.str() << "...";
                                break;
                            }
                        }
                    }

                    std::string out = ss.str();
                    pg->publicSendMessage(p, SPEAK_PRIVATE, out);
                }


Can anyone help me compile TFS 0.4?
Post automatically merged:

C++:
talkaction.cpp:233:11: error: no match for ‘operator<<’ (operand types are ‘std::stringstream {aka std::__cxx11::basic_stringstream<char>}’ and ‘std::stringstream {aka std::__cxx11::basic_stringstream<char>}’)
        sl << ss;
        ~~~^~~~~
talkaction.cpp:233:14: error: cannot bind ‘std::basic_ostream<char>’ lvalue to ‘std::basic_ostream<char>&&’
        sl << ss;
              ^~
 

Zombiegod

Member
Joined
Oct 22, 2009
Messages
198
Solutions
1
Reaction score
24
your issue is not those lines, please post your entire Talkaction.cpp

if you want to look into it yourself, you issue lays in the bits of code "std::basic_ostream<char>" and "operator<"
 
OP
A

Ancio

Member
Joined
Dec 13, 2014
Messages
25
Reaction score
5

Zombiegod

Member
Joined
Oct 22, 2009
Messages
198
Solutions
1
Reaction score
24
mind link the code you used for " PlayerCast pc = p->getCast(); "

EDIT: by code i mean the page you got the code from
Post automatically merged:

@Ancio okay did a bit of research, found this code, seems like it has differences in it that has required code for the cast system, i am not too familar with 0.4 code so i cant help say exacts.

 
Last edited:

Zombiegod

Member
Joined
Oct 22, 2009
Messages
198
Solutions
1
Reaction score
24
sorry but i don't understand your question.

Can you specify the question again?
the error is related too your cast system in your code, you seem to be missing code, i wanted to look at the original code to see what you forgot, but it seems you have no idea.
 
OP
A

Ancio

Member
Joined
Dec 13, 2014
Messages
25
Reaction score
5
the error is related too your cast system in your code, you seem to be missing code, i wanted to look at the original code to see what you forgot, but it seems you have no idea.

You ask about Talkaction.cpp? It's original code. I didn't change anything.
Specify exactly what you need.I compiled TFS for first time :<
 

Attachments

Zombiegod

Member
Joined
Oct 22, 2009
Messages
198
Solutions
1
Reaction score
24
first dont mess with that tutorial, seems like that guy messed with the code or something, try this one [Tutorial] Complie the TFS 0.4. (https://otland.net/threads/tutorial-complie-the-tfs-0-4.107486/)
Post automatically merged:

oh wait did not realize the pics were broken
Post automatically merged:

try this guide with the previous links source
 
OP
A

Ancio

Member
Joined
Dec 13, 2014
Messages
25
Reaction score
5
first dont mess with that tutorial, seems like that guy messed with the code or something, try this one [Tutorial] Complie the TFS 0.4. (https://otland.net/threads/tutorial-complie-the-tfs-0-4.107486/)
Post automatically merged:

oh wait did not realize the pics were broken
Post automatically merged:

try this guide with the previous links source

could you do that for me I will give you the data for my vps?

Each time I get a different error :/
 

Zombiegod

Member
Joined
Oct 22, 2009
Messages
198
Solutions
1
Reaction score
24

precompiled if that is alright for you
 
OP
A

Ancio

Member
Joined
Dec 13, 2014
Messages
25
Reaction score
5

precompiled if that is alright for you
Chat.cpp , Game.cpp, Iologin error. Change return false to return NULL
Error in protocolgame.cpp replace << hex with << hex.str()
C++:
protocolgame.cpp:838:31: error: expected primary-expression before ‘<’ token
      s << player->getName() < < " sent unknown byte: " << hex.str() << std::end                                                                                                                                                             l;
                               ^
protocolgame.cpp:838:56: error: no match for ‘operator<<’ (operand types are ‘co                                                                                                                                                             nst char [21]’ and ‘std::__cxx11::basic_stringstream<char>::__string_type {aka s                                                                                                                                                             td::__cxx11::basic_string<char>}’)
      s << player->getName() < < " sent unknown byte: " << hex.str() << std::end                                                                                                                                                             l;
                                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~

My Protocolgame.cpp //////////////////////////////////////////////////////////////////////// // Ope - Pastebin.com (https://pastebin.com/UPMrXt9M)
 
Top