I dug up an old C project of mine that I want to use to apply new principles to in C++. It's a simple text-based game that I can't seem to get working.
Basically, I wrote all the original code in Dev-C++ and have found the Visual C++ 2010 Express Edition to be much better and more likable to use. The problem is, the code won't compile in it. I believe it's a concern with scope, as I'm getting warnings, errors and red lines under things like variable names, functions, etc.
Some errors include:
'close' undefined; assuming extern returning int.
'name' unidentified, depite the fact 'name' is declared as global.
"close" is also red lined and is an unknown function to the compiler despite the fact I have included the correct headers, which are:
I can't understand this. The Dev-C++ setup was thus: write an 'includes' header file and put all my #includes in there, then include this header file in main(). This seemed to allow every source file in the program to have access to anything I required it to have access to, such as <time.h>.Code:#include<stdio.h> #include<ctype.h> #include<stdlib.h> #include<time.h> #include<windows.h> #include<string.h>
This doesn't work in VC++. Even if I manually include all the header files and necessary includes within each source file, it still won't run my code and some attempts have even told me I've used too many header files.
I was under the impression that C code is the same wherever you go, but apparently not?
Can anyone help me out a little? I'm considering just forgetting this environment and going back to Dev-C++, but I really don't want to.
Thanks for reading.