Strange problem

I've installed VStudio 2005 on my computer. But i'm still running in vstudio 2003 (7.1) for some projects. I am running the project below in 7.1

I got a very strange problem when running in debug mode. The wrong methods is called in a library (made the lib myself) that I use. I have not changed anything in the library for a long time. I've recompiled it after the error ocurred to check if that helped. It did not.

bool Service::StartServer(Fatal::Net::Server* serverPtr, int port)
{
try
{
m_log << "Loading " << serverPtr->GetServerName() << " on port " << port;
m_log.WriteEntry(LogBase::LP_NORMAL, "WindowsService", "Start");
serverPtr->StartServer("", port);
}
catch (Fatal::Net::SocketException& err)
{
m_log << "Failed to start " << serverPtr->GetServerName() << ": " << err.what();
m_log.WriteEntry(LogBase::LP_NORMAL, "WindowsService", "Start");
return false;
}
return true;
}

serverPtr->IsRunning() is called instead of serverPtr->GetServerName() and serverPtr->StopServer() is called instead of serverPtr->StartServer();

How can that be possible? And what is wrong?

Since I've never seen this error before I do not know what kind of info you need, so ask if you are missing anything.
[1410 byte] By [verifier] at [2007-11-19 17:47:41]
# 1 Re: Strange problem
This is very unlikely - the most likely scenario is that the right functions are being called but your debugger is several lines out of step. Therefore, when you trace into your lib, it just looks like the wrong functions are invoked. check these out...

1) Firstly, you need to to a full rebuild - not just a re-compile or a partial build. Perform a "Rebuild All".
2) Check that you haven't got more than 1 copy of the lib on your system. You're probably rebuilding the lib okay - but later, your app is then linking to an older copy. This has happened to me, more than once. Find all the copies on your system and make sure they're all identical.
John E at 2007-11-10 23:48:40 >
# 2 Re: Strange problem
I know that it's unlikely, but it do happen.

m_log << "Loading " << serverPtr->GetServerName() << " on port " << port;
m_log.WriteEntry(LogBase::LP_NORMAL, "WindowsService", "Start");

Should print the correct servername if it was calling the correct method, right? It prints some junk only (few bytes).

serverPtr->StartServer("", port);

That line throws an exception that says "server is not running", and that text is only thrown in StopServer.

I've cleaned and rebuild the project more than once. I've doublechecked my library paths.

Edit: LOL. I did another rebuild and now it works. But do you have any idea at all why it did as it did? I've had the same problem as you before that the debugger is out of sync thanks to incorrect compiled libraries. But I have never ever experienced this problem before.

Here is a log output:

#2006-01-23 08:37:54.359 5376 2 WindowsService Start Loading `7[ on port 3347*#
#2006-01-23 08:37:54.359 5376 2 WindowsService Start Failed to start `7[: Server is not running*#
verifier at 2007-11-10 23:49:40 >
# 3 Re: Strange problem
Sorry, I've never had a problem where the wrong functions were being called. Is it possible that you were rebuilding the Debug version of your lib - but then linking to the Release version? That's about all I can think of. :confused:
John E at 2007-11-10 23:50:44 >
# 4 Re: Strange problem
Sorry, I've never had a problem where the wrong functions were being called. Is it possible that you were rebuilding the Debug version of your lib - but then linking to the Release version? That's about all I can think of. :confused:

I'm using pragma in all of my libraries to include them.
So that should be impossible, right?

#if defined(DEBUG) || defined(_DEBUG)
#pragma comment(lib, "fatal.netD.lib")
#else
#pragma comment(lib, "fatal.net.lib")
#endif
verifier at 2007-11-10 23:51:38 >