Using microsoft visual c++ 2010. Everything is screwing up.
I want to take an input file, write to an output file, and use the lines of the input file as strings.
But...
On previous run, I didn't have that last printf line. So everytime I run it, it just prints 'hello'.
The program isn't finished yet, I'll finish once I get help.
At this point, I am willing enough to get a new compiler.
code:
// new__.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include "simpio.h"
#include "genlib.h"
#include "Windows.h"
#include <fstream.h>
#include <fstream>
#include <apstring.h>
#pragma warning(disable: 4996)
#pragma warning(disable: 4068)
#pragma warning(disable: 4018)
#pragma warning(disable: 4081)
#pragma error(disable: 4430)
void main()
{
printf("hello");
ifstream infile;
ofstream outfile;
infile.open("input.txt");
outfile.open("output.txt");
apstring string;
printf("done");
}
!@#$%^& errors:
1>------ Build started: Project: new__, Configuration: Debug Win32 ------
1> new__.cpp
1>c:\program files\microsoft visual studio 10.0\vc\include\simpio.h(44): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 10.0\vc\include\string.h(188) : see declaration of 'strncpy'
1>c:\program files\microsoft visual studio 10.0\vc\include\simpio.h(57): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 10.0\vc\include\string.h(105) : see declaration of 'strcpy'
1>c:\program files\microsoft visual studio 10.0\vc\include\simpio.h(98): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 10.0\vc\include\stdio.h(325) : see declaration of 'sscanf'
1>c:\program files\microsoft visual studio 10.0\vc\include\simpio.h(135): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 10.0\vc\include\stdio.h(325) : see declaration of 'sscanf'
1>c:\program files\microsoft visual studio 10.0\vc\include\simpio.h(172): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 10.0\vc\include\stdio.h(325) : see declaration of 'sscanf'
1>c:\program files\microsoft visual studio 10.0\vc\include\yvals.h(536): error C2632: 'bool' followed by 'bool' is illegal
1>c:\program files\microsoft visual studio 10.0\vc\include\yvals.h(536): warning C4091: 'typedef ' : ignored on left of 'bool' when no variable is declared
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(21): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(22): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(24): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(25): error C2146: syntax error : missing ';' before identifier 'ios'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(26): warning C4081: expected 'identifier'; found 'else'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(27): error C2146: syntax error : missing ';' before identifier 'ios_base'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(27): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(27): error C2378: 'ios' : redefinition; symbol cannot be overloaded with a typedef
1> c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(25) : see declaration of 'ios'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(27): warning C4091: '' : ignored on left of 'int' when no variable is declared
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(28): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(30): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(31): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(33): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(34): error C2146: syntax error : missing ';' before identifier 'ostringstream'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(34): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(34): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(35): error C2146: syntax error : missing ';' before identifier 'istringstream'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(35): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(35): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(37): warning C4081: expected 'identifier'; found 'else'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(38): error C2146: syntax error : missing ';' before identifier 'ostrstream'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(38): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(38): error C2378: 'ostringstream' : redefinition; symbol cannot be overloaded with a typedef
1> c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(34) : see declaration of 'ostringstream'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(38): warning C4091: '' : ignored on left of 'int' when no variable is declared
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(39): error C2146: syntax error : missing ';' before identifier 'istrstream'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(39): error C2378: 'istringstream' : redefinition; symbol cannot be overloaded with a typedef
1> c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(35) : see declaration of 'istringstream'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(39): warning C4091: '' : ignored on left of 'int' when no variable is declared
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(40): error C2146: syntax error : missing ';' before identifier 'strstream'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(40): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(40): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(41): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(43): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(45): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(52): warning C4081: expected 'identifier'; found 'if'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(55): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(64): error C2371: 'std::streampos' : redefinition; different basic types
1> c:\program files\microsoft visual studio 10.0\vc\include\iosfwd(128) : see declaration of 'std::streampos'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(71): error C2371: 'ios' : redefinition; different basic types
1> c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(27) : see declaration of 'ios'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(183): warning C4018: '>' : signed/unsigned mismatch
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(197): warning C4018: '>' : signed/unsigned mismatch
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(210): warning C4018: '>' : signed/unsigned mismatch
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(223): warning C4018: '>' : signed/unsigned mismatch
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(236): warning C4018: '>' : signed/unsigned mismatch
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(268): error C2365: 'istream::tie' : redefinition; previous definition was 'data member'
1> c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(262) : see declaration of 'istream::tie'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(304): error C2063: 'istream::tie' : not a function
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(416): error C2371: 'std::fstream' : redefinition; different basic types
1> c:\program files\microsoft visual studio 10.0\vc\include\iosfwd(649) : see declaration of 'std::fstream'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(418): error C2371: 'std::ofstream' : redefinition; different basic types
1> c:\program files\microsoft visual studio 10.0\vc\include\iosfwd(648) : see declaration of 'std::ofstream'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(424): error C2371: 'std::ifstream' : redefinition; different basic types
1> c:\program files\microsoft visual studio 10.0\vc\include\iosfwd(647) : see declaration of 'std::ifstream'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(449): warning C4068: unknown pragma
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(453): error C3861: 'G__charformatter': identifier not found
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(462): error C2365: 'endl' : redefinition; previous definition was 'function'
1> c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(438) : see declaration of 'endl'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(463): error C2365: 'ends' : redefinition; previous definition was 'function'
1> c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(439) : see declaration of 'ends'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(464): error C2365: 'flush' : redefinition; previous definition was 'function'
1> c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(437) : see declaration of 'flush'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(465): error C2365: 'ws' : redefinition; previous definition was 'function'
1> c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(440) : see declaration of 'ws'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(466): error C2365: 'WS' : redefinition; previous definition was 'function'
1> c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(444) : see declaration of 'WS'
1>c:\program files\microsoft visual studio 10.0\vc\include\iostream.h(475): fatal error C1083: Cannot open include file: '_iostream': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Notice that not one of these are actually in MY program.
Please help by telling me what I'm doing wrong and/or suggesting a new compiler and a link to where I can download it for free.
Thanks