Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (-1) | Shanky.com
Errors in C++!

 
Post new topic   Reply to topic Printable version
 View previous topic  Afterburner Effect Post :: Post Reveiw  View next topic  
Author Message
Versetti
Novice


Gender:Gender:Male
Joined: Jan 05 2004
Posts: 54
Offline

PostPosted: Thu Mar 04, 2004 9:40 pm    Post subject: Errors in C++! Reply to topic Reply with quote

These errors I got in the past alot and nver knew how to fix and it is ticking me off! here is what it says

Code: Show/Hide
--------------------Configuration: Server - Win32 Debug--------------------
Compiling...
packets.cpp
Linking...
packets.obj : error LNK2005: "int mainid" (?mainid@@3HA) already defined in main.obj
packets.obj : error LNK2005: "unsigned char * recvmsg" (?recvmsg@@3PAEA) already defined in main.obj
packets.obj : error LNK2005: "struct players * player" (?player@@3PAUplayers@@A) already defined in main.obj
Debug/Server.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

Server.exe - 4 error(s), 0 warning(s)


and the files I have is two .cpp files and two .h file.

would anyone know how the hell I can fix this?
Back to top
View users profile Send private message Add User to Ignore List AIM Address MSN Messenger
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Thu Mar 04, 2004 10:03 pm    Post subject: Reply to topic Reply with quote

My guess is that you are defining those things in a header file rather than declaring them, so each .cpp file has its own copy of the data.

A header file should only declare data like:

extern int xyz;

A single source file in your project should declare that data like:

int xyz;

If this is not your problem, post all 4 of your files and I'll take a closer look.
_________________
4,691 irradiated haggis!
Back to top
View users profile Send private message Add User to Ignore List
AKA Versetti
Guest


Offline

PostPosted: Mon Mar 08, 2004 1:01 pm    Post subject: Reply to topic Reply with quote

Grrrrrrr I'm going to learn more with linked lists and rewrite the whole danm thing getting tired of that error, and yes I tried to delcare them as extern and still the same danm error icon_sad.gif .
Back to top
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Mon Mar 08, 2004 2:23 pm    Post subject: Reply to topic Reply with quote

Post your code. Don't change things just because you get an error you don't understand. Learn why you are getting the error. Learnm what the error means. It will save you lots of trouble in the future.

If you 'd prefer to send me the code outside of this chat, we can talk over email or ICQ.
Back to top
View users profile Send private message Add User to Ignore List
Versetti
Novice


Gender:Gender:Male
Joined: Jan 05 2004
Posts: 54
Offline

PostPosted: Mon Mar 08, 2004 3:57 pm    Post subject: Reply to topic Reply with quote

Ok if you suggest to talk me on ICQ it is 313030930
I'm just getting pissed from these linked lists
Back to top
View users profile Send private message Add User to Ignore List AIM Address MSN Messenger
AKA Versetti
Guest


Offline

PostPosted: Tue Mar 09, 2004 9:12 am    Post subject: Reply to topic Reply with quote

I kinda got it now just for the UDP sockets and how to organize the players and stuff
Back to top
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Tue Mar 09, 2004 10:18 am    Post subject: Reply to topic Reply with quote

Versetti wrote:
I'm just getting pissed from these linked lists


Describe what you are using LL for, and I can discuss it. What LL functions do you need? Insert at head/tail/random? Delete head/tail/random? Sort? Find?
Back to top
View users profile Send private message Add User to Ignore List
AKA Versetti
Guest


Offline

PostPosted: Tue Mar 09, 2004 1:52 pm    Post subject: Reply to topic Reply with quote

What I really need is a nicely done tutroial on how to make linked lists and their funcation. I really only made one linked list but it was not all that great.
Back to top
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Tue Mar 09, 2004 4:08 pm    Post subject: Reply to topic Reply with quote

*hypnotizes versetti* Use STL lists, use STL lists...
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Tue Mar 09, 2004 4:32 pm    Post subject: Reply to topic Reply with quote

*hypnotizes cyan~fire* gay...gay...
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Tue Mar 09, 2004 4:37 pm    Post subject: Reply to topic Reply with quote

Lol. I know they're bad, but it's better than trying to make one yourself.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Tue Mar 09, 2004 4:42 pm    Post subject: Reply to topic Reply with quote

Linked lists are tiny and easy to code. It's better to learn them than to always rely on some wrapper. That way if you are having a problem you can debug with intelligence. People that rely on classes to do all their work for them grow up to write crappy code.
Back to top
View users profile Send private message Add User to Ignore List
Versetti
Novice


Gender:Gender:Male
Joined: Jan 05 2004
Posts: 54
Offline

PostPosted: Tue Mar 09, 2004 8:03 pm    Post subject: Reply to topic Reply with quote

yes I agree I'm not too much with using wrappers since they are really just others work. Like UDP Sockets I'm making my own while others suggest me to use wrappers and stuff. But I really need to learn linked lists so I have to try something to help me that is ez to understand.
Back to top
View users profile Send private message Add User to Ignore List AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> General Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 352 page(s) served in previous 5 minutes.

phpBB Created this page in 0.076649 seconds : 33 queries executed (63.5%): GZIP compression disabled