Hi there, I've been trying to get back into coding for a while, so I figured I'd start with some simple SDL, now, without the file i/o, this compiles fine, but when I throw in the stdio code, it starts throwing errors. This I'm not sure about, I don't see any problem with the code itself, however, like I said, I might as well be a newbie, and figured I'd come here to get someone with a little more experience with this type of thing to look at it.
I guess my question boils down to: "Why doesn't this compile under Microsoft's Visual C++ 2008 Express?"
I've attached the error log at the bottom of the code snippet. Thanks in advance for any help.
#include "SDL/SDL.h"
#include "stdio.h"
int main(int argc, char *argv[])
{
FILE *stderr;
FILE *stdout;
stderr = fopen("stderr", "wb");
stdout = fopen("stdout", "wb");
SDL_Init(SDL_INIT_EVERYTHING);
fprintf(stdout, "SDL INITIALIZED SUCCESSFULLY\n");
SDL_Quit();
fprintf(stderr, "SDL QUIT.\n");
fclose(stderr);
fclose(stdout);
return 0;
}
/*
1>------ Build started: Project: opengl_crap, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\opengl_crap\opengl_crap\main.cpp(6) : error C2090: function returns array
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\opengl_crap\opengl_crap\main.cpp(6) : error C2528: '__iob_func' : pointer to reference is illegal
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\opengl_crap\opengl_crap\main.cpp(6) : error C2556: 'FILE ***__iob_func(void)' : overloaded function differs only by return type from 'FILE *__iob_func(void)'
1> c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(132) : see declaration of '__iob_func'
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\opengl_crap\opengl_crap\main.cpp(7) : error C2090: function returns array
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\opengl_crap\opengl_crap\main.cpp(7) : error C2528: '__iob_func' : pointer to reference is illegal
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\opengl_crap\opengl_crap\main.cpp(9) : error C2440: '=' : cannot convert from 'FILE *' to 'FILE ***'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\opengl_crap\opengl_crap\main.cpp(10) : error C2440: '=' : cannot convert from 'FILE *' to 'FILE ***'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\opengl_crap\opengl_crap\main.cpp(13) : error C2664: 'fprintf' : cannot convert parameter 1 from 'FILE ***' to 'FILE *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\opengl_crap\opengl_crap\main.cpp(15) : error C2664: 'fprintf' : cannot convert parameter 1 from 'FILE ***' to 'FILE *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\opengl_crap\opengl_crap\main.cpp(17) : error C2664: 'fclose' : cannot convert parameter 1 from 'FILE ***' to 'FILE *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\opengl_crap\opengl_crap\main.cpp(18) : error C2664: 'fclose' : cannot convert parameter 1 from 'FILE ***' to 'FILE *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\opengl_crap\opengl_crap\Debug\BuildLog.htm"
1>opengl_crap - 11 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
*/