Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / sstream and DGDK

Author
Message
Chaosed0
13
Years of Service
User Offline
Joined: 9th Mar 2011
Location:
Posted: 9th Mar 2011 18:32
Hi, I've been trying to use stringstream with dark gdk to no avail; I keep running into linker errors. Here's an example:


I've tried setting my build settings to /MT, but that gives me _ITERATOR_DEBUG_LEVEL errors:

Should I just not use stringstream or is there a way to fix these errors?
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 10th Mar 2011 03:22
Those errors mean that one of the libraries were built in debug mode while another is built in release mode. Not sure if the problem is with Dark GDK or with stringstream. Are you in Release mode or Debug mode?


Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 10th Mar 2011 07:36
Maybe we can find out more if you post actual code and not only the errors. my guess is that you are using namespace std. instead of using a namespace, put std:: on the left of the std type variables. for example, for a string, use std::string and remove using namespace std;.

hi
Chaosed0
13
Years of Service
User Offline
Joined: 9th Mar 2011
Location:
Posted: 10th Mar 2011 15:58 Edited at: 10th Mar 2011 17:23
Quote: "Those errors mean that one of the libraries were built in debug mode while another is built in release mode. Not sure if the problem is with Dark GDK or with stringstream. Are you in Release mode or Debug mode?"

I'm in debug mode. It works in release mode, I have to be able to set breakpoints or else there's no way to manage some of the bugs I get.
Quote: "Maybe we can find out more if you post actual code and not only the errors. my guess is that you are using namespace std. instead of using a namespace, put std:: on the left of the std type variables. for example, for a string, use std::string and remove using namespace std;."

As far as I can see, I don't nave "using namespace std;" anywhere. As for posting code, my project's pretty large, with many classes; I suppose I could post the level.cpp, which is being referenced in the error. It's pretty massive itself though:
Chaosed0
13
Years of Service
User Offline
Joined: 9th Mar 2011
Location:
Posted: 10th Mar 2011 16:04
I can't edit my post yet, since I'm a new member and it hasn't shown up, so I'll just make a new post: You were right, Cetobasilius. I had a "using namespace std;" in one of my #include files that was causing problems. I'll be sure to remember not to use that line of code in the future, but why exactly does that make a difference?
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 10th Mar 2011 20:42 Edited at: 10th Mar 2011 20:43
well, it sort of puts std:: behind some variable types, and i myself was not able to use it that way and had a problem like that to use strings... usually on tutorials or documents it states to use "using namespace std;" and i used it, because strings would not work without it, but i later figured out that putting std:: before the variable type would replace the namespace only on the type of variable i wanted (the ones that belong to std like sstream i believe and string) i dont clearly know what causes it but thats what fixed my problem some years ago, but im glad it worked!

hi
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 11th Mar 2011 00:06
What probably happened wasn't because of the using namespace std itself more the object file generated by that include file was in the wrong configuration somehow and you editing that file forced the compiler to recompile the object file to the correct configuration. I think.


Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 11th Mar 2011 00:28 Edited at: 11th Mar 2011 00:30
when this happened to me it was the using namespace. i had already tried rebuilding the whole project so no. removing using namespace std fixed my problem. And it probably fixed Chaosed0s problem too

difference using namespace and not using:

Without:


Using:


hi

Login to post a reply

Server time is: 2024-06-27 21:55:06
Your offset time is: 2024-06-27 21:55:06