Last visit was: It is currently Thu Mar 28, 2024 5:40 am


All times are UTC-05:00




Post new topic Reply to topic  [22 posts ] 
Author Message
 Post subject:Re: Issues with CrissCross
PostPosted:Sat Jul 05, 2008 7:34 am 
 

Joined:Sat Jul 05, 2008 7:24 am
Posts:1
I am able to build the examples. The problem is when I try to build my own project. I get a lot of linker errors that tell me that I have symbol redefinition.

Here are a few examples :
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)

msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: static unsigned int __cdecl std::char_traits<char>::length(char const *)" (?length@?$char_traits@D@std@@SAIPBD@Z) already defined in CrissCross.lib(debug.obj)

CrissCross.lib(console.obj) : error LNK2019: unresolved external symbol __imp__SetWindowPos@28 referenced in function "public: __thiscall CrissCross::IO::Console::Console(bool,bool)"
(??0Console@IO@CrissCross@@QAE@_N0@Z)


I can't quite grasp whats wrong. I use the same compiler for both the library build and my project build. I think my project settings might be a little off, but I have no way of telling exactly...

I use Visual c++ Express 2005.


I had a different Idea to put my code into the examaple project but when I do this I get one linker error:

CrissCross.lib(universal_include.obj) : error LNK2019: unresolved external symbol "int __cdecl RunApplication(int,char * *)" (?RunApplication@@YAHHPAPAD@Z) referenced in function _WinMain@16


I presume it's because I don't use the Console stuff from the library. The simple fact is that I want to only use the CPUID feature.

The library version is 0.7.1

What might be wrong?


Top
Offline  
 Post subject:Re: Issues with CrissCross
PostPosted:Sun Jul 06, 2008 2:45 pm 
Literally Nine
User avatar
 

Joined:Tue Mar 01, 2005 9:00 am
Posts:1263
You might want to refer back examples.

In short, you must define RunApplication. Do it as you would define main normally:
Code:
int RunApplication ( int argc, char **argv ) { Console *console = new Console (); //Do all sorts of things return 0; }
And do not define main at all. CrissCross requires it for proper init.

If you still can't figure it out, post some source. We'll try to help.


Top
Offline  
 Post subject:Re: Issues with CrissCross
PostPosted:Mon Aug 25, 2008 5:45 pm 
User avatar
 

Joined:Sun Feb 12, 2006 8:56 pm
Posts:1019
Website:http://eddieringle.com
Location:Detroit, MI
Okay, trying to do stuff with sockets, decided on making a mini web server. Here's my webserver.cpp file:
Code:
#include "header.h" TCPSocket *sock = NULL; TCPSocket *ssock = NULL; TCPSocket *tsock = NULL; class Server { public: Server(int lport) { bool isRunning = true; olog("Creating Socket..."); sock = new TCPSocket(); olog("Listening for connections..."); sock->Listen(lport); while(isRunning) { ssock = new TCPSocket(); ssock->Accept(&sock); string hostip = ssock->GetRemoteIP(); alog("Connection from " + hostip); if(ssock->IsReadable()) { string in; ssock->Read(in); if(in == "jerrysaysno") { isRunning = false; } alog("Closing link to " + hostip); ssock->Close(); } olog("Closing Socket..."); sock->Close(); } } }; Server *s = NULL; void startServer() { // todo: read from config // todo: set config variables int port = 80; s = new Server(port); } void stopServer() { tsock = new TCPSocket(); tsock->Connect("localhost",80); if(tsock->IsWritable()) { tsock->Send("jerrysaysno"); } tsock->Close(); }
EDIT: I have managed to get it to compile with the above updated code, however when running the program triggers an "invalid null pointer" breakpoint.

Please help!

_________________
-- Eddie Ringle

Check out Elysian Shadows and consider backing us on Kickstarter!

====================================

Image


Top
Offline  
 Post subject:Re: Issues with CrissCross
PostPosted:Wed Aug 27, 2008 4:23 am 
 

Joined:Tue Aug 12, 2008 6:03 pm
Posts:6
Why are you putting the whole thing in one file?

The class with the prototypes can you put in the header file.
like this:
Server.h
Code:
class Server { public: Server(int lport); ~Server(); void startServer(); void stopServer(); };
and in the cpp file
Server.cpp
Code:
#include "Server.h" Server::Server(int lport) { ... } Server::~Server() { ... } void Server::startServer() { ... } void Server::stopServer() { ... }


Top
Offline  
 Post subject:Re: Issues with CrissCross
PostPosted:Wed Aug 27, 2008 10:29 am 
User avatar
 

Joined:Sun Feb 12, 2006 8:56 pm
Posts:1019
Website:http://eddieringle.com
Location:Detroit, MI
Yes, thanks for the tip but right now I'd just like to get it running.

_________________
-- Eddie Ringle

Check out Elysian Shadows and consider backing us on Kickstarter!

====================================

Image


Top
Offline  
 Post subject:Re: Issues with CrissCross
PostPosted:Sat Aug 30, 2008 3:01 pm 
Literally Nine
User avatar
 

Joined:Sat Apr 02, 2005 3:31 pm
Posts:1171
Location:The vicinity of an area adjacent to a location.
When you accept a connection with Accept(), the provided TCPSocket parameter is the opened connection. So in your case, reads/writes should happen on 'sock' instead of 'ssock'. And further, you should probably add a way to handle multiple connections, because that wouldn't be very uncommon (some browsers use three or four connections to retrieve a web page). You could store all Accept()ed sockets in a LList and then iterate through them in the main loop (the while(isRunning)).

_________________
- Tycho

Image


Top
Offline  
 Post subject:Re: Issues with CrissCross
PostPosted:Sat Aug 30, 2008 9:58 pm 
User avatar
 

Joined:Sun Feb 12, 2006 8:56 pm
Posts:1019
Website:http://eddieringle.com
Location:Detroit, MI
Looks good, I'll test it out when we get home from camping on Monday. Then I'll have to prepare for my first day of high school on Tuesday. :(

Oh, any tips for that?

_________________
-- Eddie Ringle

Check out Elysian Shadows and consider backing us on Kickstarter!

====================================

Image


Top
Offline  
Display posts from previous: Sort by 
Post new topic Reply to topic

All times are UTC-05:00


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created by Miah with assistance from hyprnova