Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8442197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:47:08+00:00 2026-06-10T08:47:08+00:00

I globally define: vector<player> cUser; The player struct is as so: struct player {

  • 0

I globally define:

vector<player> cUser;

The player struct is as so:

struct player
{
char buffer[256];
string username;
string password;
string version;
int playerID;
int X;
int Y;
int direction;
string chats[5];
unsigned long robotID[3];
int gender;
int securityLevel;
float rep;
int isMember;
int inBattle;
int isFollowed;
int playerLocked;
string currentMap;
string lastHavenMap;
int mapHeight;
int mapWidth;
unsigned long money;
unsigned long points;
int wins;
int losses;
string oldIP;
string newIP;
unsigned long lastOnline;
int layer;
int rank;
int kicked;
void logout();
void refresh();
//other
void startLoops();
int execLoops;
//for the robots
Robots Robot[3];
int robotOut;
int totalRobots;
void addExp(int, int);
void subExp(int, int);
int calcRobotExp(int);
//battles
player *enemyBattleUser;//enemy is a player
npc enemyBattleNpc;//enemy is an npc or boss
Robots rogueRobot;//enemy is a rogue robot
string mainBattleUser;
int battleChoice;//which choice of the battleChoiceType
int battleChoiceType;//0 attack, 1 team, 2 flee
int battleSAD;//short for battleSceneAlgorythmsDone
int battleType;//0-rogue, 1=npc, 2-boss 3-player
int subHealth(int, int, int);
void addHealth(int, int, int);
void battleStart(string, int, int);
void battleEnd(int);
void getMove();
void userTurn(int&, int&, int&, string&, string&, int&);
void enemyTurn(int&, int&, int&, string&, string&, int&);
void extraDamage(int&, string&, string&, int);
void battleScene();
//sockets
int sockID;//main socket id
int cSockID;//chat socket id
void userSockError();
//roam
int rogueBattleCalc();
void warp(string, int, int);
int checkNpcBattle();
void sendInitData();
void roamWorld();
int playerWalk(int);
//chatting
void chatLoop();
void executeCommand(string);
int lastMessageSeen[5];
string chatName[5];
int chatsOpen;
//threads
boost::thread mainThread;
boost::thread chatThread;
};

Then when i try to resize it by using any of the following, it gives me a very big error which I believe is telling me to make a constructor/destructor, which when I do it still gives me the same error.

cUser.resize(cUser.size()+1);

player tempUser;
//members of tempUser set here
cUser.push_back(tempUser);

cUser.erase(index);

But when I resize this struct in the same way, it works fine and it still has no constructor/destructor, and it is defined right next to cUser in the same way.

struct chatbox
{
       //chatbox structure
       string name;
       int locked;//0 no, 1 yes
       int staffOnly;//0 no, 1 yes
       int mType[5];
       int security[5];
       string username[5];
       string message[5];//the higher the index the newer the message
       int messagesNo;
};

Any help would be appreciated, thank you.

Error:

$ make
g++    -c -o server.o server.cpp
In file included from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/i686-pc-cygw
in/bits/c++allocator.h:34:0,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/allocat
or.h:48,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/string:43,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/locale_
classes.h:42,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/ios_bas
e.h:43,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/ios:43,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/istream:40,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/fstream:40,
                 from server.cpp:5:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/ext/new_allocator.h: In member fun
ction `void __gnu_cxx::new_allocator<_Tp>::construct(_Tp*, const _Tp&) [with _Tp
 = player, _Tp* = player*]':
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_vector.h:745:6:   instant
iated from `void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _T
p = player, _Alloc = std::allocator<player>, value_type = player]'
server.cpp:373:32:   instantiated from here
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/ext/new_allocator.h:105:9: error:
no matching function for call to `player::player(const player&)'
user.hpp:81:1: note: candidates are: player::player()
user.hpp:81:1: note:                 player::player(player&)
In file included from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/vector:69:0,

                 from server.cpp:10:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/vector.tcc: In member functio
n `void std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterat
or, const _Tp&) [with _Tp = player, _Alloc = std::allocator<player>, std::vector
<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<player*, std::vector<play
er> >, typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer = player
*]':
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_vector.h:749:4:   instant
iated from `void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _T
p = player, _Alloc = std::allocator<player>, value_type = player]'
server.cpp:373:32:   instantiated from here
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/vector.tcc:306:19: error: no
matching function for call to `player::player(const player&)'
user.hpp:81:1: note: candidates are: player::player()
user.hpp:81:1: note:                 player::player(player&)
In file included from server.hpp:9:0,
                 from server.cpp:15:
/usr/include/boost/thread/detail/thread.hpp: In member function `player& player:
:operator=(player&)':
user.hpp:81:1:   instantiated from `void std::vector<_Tp, _Alloc>::_M_insert_aux
(std::vector<_Tp, _Alloc>::iterator, const _Tp&) [with _Tp = player, _Alloc = st
d::allocator<player>, std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_i
terator<player*, std::vector<player> >, typename std::_Vector_base<_Tp, _Alloc>:
:_Tp_alloc_type::pointer = player*]'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_vector.h:749:4:   instant
iated from `void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _T
p = player, _Alloc = std::allocator<player>, value_type = player]'
server.cpp:373:32:   instantiated from here
/usr/include/boost/thread/detail/thread.hpp:114:17: error: `boost::thread& boost
::thread::operator=(boost::thread&)' is private
user.hpp:81:1: error: within this context
/usr/include/boost/thread/detail/thread.hpp:114:17: error: `boost::thread& boost
::thread::operator=(boost::thread&)' is private
user.hpp:81:1: error: within this context
In file included from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/vector:69:0,

                 from server.cpp:10:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/vector.tcc: In member functio
n `void std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterat
or, const _Tp&) [with _Tp = player, _Alloc = std::allocator<player>, std::vector
<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<player*, std::vector<play
er> >, typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer = player
*]':
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/vector.tcc:312:4: note: synth
esized method `player& player::operator=(player&)' first required here
In file included from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/vector:63:0,

                 from server.cpp:10:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_construct.h: In function
`void std::_Construct(_T1*, const _T2&) [with _T1 = player, _T2 = player]':
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_uninitialized.h:74:3:   i
nstantiated from `static _ForwardIterator std::__uninitialized_copy<<anonymous>
>::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _I
nputIterator = player*, _ForwardIterator = player*, bool <anonymous> = false]'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_uninitialized.h:116:46:
 instantiated from `_ForwardIterator std::uninitialized_copy(_InputIterator, _In
putIterator, _ForwardIterator) [with _InputIterator = player*, _ForwardIterator
= player*]'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_uninitialized.h:318:63:
 instantiated from `_ForwardIterator std::__uninitialized_copy_a(_InputIterator,
 _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator =
player*, _ForwardIterator = player*, _Tp = player]'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_uninitialized.h:328:24:
 instantiated from `_ForwardIterator std::__uninitialized_move_a(_InputIterator,
 _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = player*,
_ForwardIterator = player*, _Allocator = std::allocator<player>]'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/vector.tcc:338:8:   instantia
ted from `void std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>:
:iterator, const _Tp&) [with _Tp = player, _Alloc = std::allocator<player>, std:
:vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<player*, std::vect
or<player> >, typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer =
 player*]'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_vector.h:749:4:   instant
iated from `void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _T
p = player, _Alloc = std::allocator<player>, value_type = player]'
server.cpp:373:32:   instantiated from here
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_construct.h:80:7: error:
no matching function for call to `player::player(const player&)'
user.hpp:81:1: note: candidates are: player::player()
user.hpp:81:1: note:                 player::player(player&)
<builtin>: recipe for target `server.o' failed
make: *** [server.o] Error 1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:47:10+00:00Added an answer on June 10, 2026 at 8:47 am

    One possible problem is that your player class has boost::thread data members, and these are not copyable or assignable. Since vector::resize() can require copying and/or assignment, the compilation fails.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I define and initialize a large vector globally, then will its size be
Is there a way to globally define a rails app to only serve json
I have a struct defined in a header as follows: #define LC_ERR_LEN 300 typedef
I want to define a macro globally. I want to override NSLocalizedString() throughout my
where should i define a variable(collection) for it to be globally accessible both in
Is there a way to globally declare a #define? Like I want to have
I was writing a code , in which when i declare a vector globally
I'm trying to modify the following globally defined variable: static int players; from the
How do I globally configure git to use a particular editor (e.g. vim )
How do I globally change the way form validation errors are displayed in Symfony2?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.