While finishing up my app, I included into the project the code for loading and injecting my dll into running processes.

Once compiling I received these errors

error C2039: 'getchar' : is not a member of '`global namespace''
error C2873: 'getchar' : symbol cannot be used in a using-declaration
error C2039: 'putchar' : is not a member of '`global namespace''
error C2873: 'putchar' : symbol cannot be used in a using-declaration

I narrowed down the cause to be from just including fstream.

I cannot find the problem, the only 2 similar errors I could find did not relate from fstream.

Its not possible that I could have accidentally altered the file so after this many hours I have no idea what could be causing this.


Extra: It does have to do with that file since it gives those errors whenever I include it into any project.

Check to see that <cstdio> was included and not <stdio.h>

just having

#include <Windows.h>
#include <fstream>

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow )
{
	return 0;
}

gives off the error since its fstream->istream->ostream->ios->xlocnum->cstdio->stdio.h

problem lies with cstdio

I switched over to using _iobuf instead now ( still need answer )

also while editing the video ( about the program ) I started getting popups saying that im out of ram ( o_o )

nothing is running over 200,000k and my program is running at a mere 900k

My firefox is randomly crashing and having trouble painting itself.

could this be caused by my program ( a dll injector )

The problem might be compiler specific. I used VC++ 2008 Express and had no errors with the code snippet you posted. What compiler are you using?

The problem might be compiler specific. I used VC++ 2008 Express and had no errors with the code snippet you posted. What compiler are you using?

Im using vs 2010 beta 2, and fstream worked fine up until I added the dll injection snippet. I managed to get the text io to work with FILE ( _iobuf ) using stdio.h but I dont know why all of a sudden cstdio is acting out.

Edit: now my vs is giving a "Application failed to start" popup.

>>Im using vs 2010 beta 2,
Well it is in beta and probably still has a few bugs. Compile with 2008 and see if that problem still persists.

Tested in VC++ 2008 express...

And it works :]
You wouldn't happen to know how to fix the bug, would you? :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.