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 / c++ objects and files

Author
Message
locomustard
13
Years of Service
User Offline
Joined: 9th Aug 2010
Location:
Posted: 20th Aug 2010 20:47
I am trying to figure out a way to read and write objects to and from a file, since the compiler throws a tantrum when i use namespace std i need to know of an alternative to using predefined variable types (int, char double ect.) to populate the file and data piece by piece. is that possible?
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 20th Aug 2010 21:27
lol! It would be much easier to fix the problem - try making a new project, the settings must be messed up.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 20th Aug 2010 22:04
Have you changed the runtime library from multi-threaded debug(/MTd) to multi-threaded(/MT)?
Its in options/projects/c++/code generation.

locomustard
13
Years of Service
User Offline
Joined: 9th Aug 2010
Location:
Posted: 21st Aug 2010 01:30
i have tried this in several differnet apllications and none will allow me to use namespace std. and I dont see where to change runtime libraries
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 21st Aug 2010 02:24
Project--> <project name>properties--> Configuration Properties--> C/C++--> Code Generation

Change from multi-threaded debug(/MTd) to multi-threaded(/MT)

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 21st Aug 2010 03:21
I don't think that the library linkage would effect the compiler's ability to recognize namespace std...

It sounds to me that you're not #including the right files:

#include <fstream>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <ostream>
#include <sstream>
#include <streambuf>
#include <strstream>

A combination of one or more of the files should suffice; for example:

#include <fstream>

would allow you to open/create a file where you can read/write from/to using the << and >> operators;



In short, check which files you're #including; make sure that one (or more) of those listed above are being included... Then std:: namespace should be recognized.

I hope this helps,

JTK
locomustard
13
Years of Service
User Offline
Joined: 9th Aug 2010
Location:
Posted: 21st Aug 2010 06:56
i changed the runtime library which fixed the problem. thank you.

Login to post a reply

Server time is: 2024-07-02 09:35:06
Your offset time is: 2024-07-02 09:35:06