hello freinds.I am anshul agarwal doing my summer internship in Germany.
I am facing one problem in visual c++..

Actually i have done a project in borland c++ but because of memory constrain, I am forced to switch over to visual c++...

My program is to read 5000 data from a txt file, select them on sme basis, do calculations on them and print their result...

when i did the same thing with 500 data on borland, i am getting right result which means my coding is absolutely correct.

but when i copy,paste the same thing in visual c++, i m getting 54 erros..i think i dont know abcd of visual c++.

plz some1 help me just how to compile it...I dont need anything more....i think i am unable to include header files..me using visual c++ 2005 express edition..

plz help me as soon as possible.

We only can help if you post the code/errors.

>>i am getting right result which means my coding is absolutely correct.
Not necessarily. Did you write pure ANSI C or C++ ? Or did you mix it in with Borland-specific functions ? Just because it compiles with Borland doesn't mean diddly squat if it can't be compiled with other compilers.

My guess is that you included very old header file <iostream.h>. M$ compilers, as well as ALL other modern compilers use the current <iostream> (without .h extension) then code the using statements

#include <iopstream>
using std::cout;
using std::cin;
// etc

If your program is using a lot of those, then you can do it like this

#include <iostream>

using namespace std;

I am facing one problem in visual c++..

Actually i have done a project in borland c++ but because of memory constrain, I am forced to switch over to visual c++...

My program is to read 5000 data from a txt file, select them on sme basis, do calculations on them and print their result...

when i did the same thing with 500 data on borland, i am getting right result which means my coding is absolutely correct.

but when i copy,paste the same thing in visual c++, i m getting 54 erros..i think i dont even know abcd of visual c++.

plz some1 help me just how to compile it...i think i am unable to include header files..me using visual c++ 2005 express edition..

plz help me as soon as possible.

the errors are :

1>c:\tcwin45\bin\finalpro.cpp(94) : error C2065: 's' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(116) : error C2065: 'cout' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(116) : error C2065: 'endl' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(126) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(126) : error C2065: 'scientific' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(126) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(126) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(126) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(127) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(127) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(127) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(127) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(128) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(128) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(128) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(128) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(129) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(129) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(129) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(129) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(131) : error C2065: 'ofstream' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(131) : error C2146: syntax error : missing ';' before identifier 'abc'
1>c:\tcwin45\bin\finalpro.cpp(131) : error C2065: 'abc' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(132) : error C2228: left of '.open' must have class/struct/union
1> type is ''unknown-type''
1>c:\tcwin45\bin\finalpro.cpp(132) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(132) : error C2065: 'out' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(132) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(132) : error C2065: 'ate' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(135) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(135) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(135) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(135) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(136) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(136) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(136) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(136) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(137) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(137) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(137) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(137) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(138) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(138) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(138) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(138) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(140) : error C2228: left of '.close' must have class/struct/union
1> type is ''unknown-type''
1>c:\tcwin45\bin\finalpro.cpp(172) : error C3861: 'clrscr': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(177) : error C2065: 'cin' : undeclared identifier
1>Build log was saved at "file://c:\Users\Anshul Agarwal\Documents\Visual Studio 2005\Projects\final project\final project\Debug\BuildLog.htm"
1>final project - 54 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

yes i error is solved...do i have to do the same thing for string.h, stdio.h, process.h, math.h??

wats the use of stdafx.h?

I am facing one problem in visual c++..

when i did the same thing with 500 data on borland, i am getting right result which means my coding is absolutely correct.

No, that DOES NOT mean your coding is absolutely correct! I know nothing about Borland except I keep hearing on these forums that it's really old. Different compilers will let you get away with different things. Just because the compiler doesn't complain doesn't necessarily mean everything is good. Sometimes you just get lucky. For example, lots of people post void main () here and get away with it. When I put that in Dev C++, it gives me an error. Same program, different compilers, different results.


the errors are :

1>c:\tcwin45\bin\finalpro.cpp(94) : error C2065: 's' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(116) : error C2065: 'cout' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(116) : error C2065: 'endl' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(126) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(126) : error C2065: 'scientific' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(126) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(126) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(126) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(127) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(127) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(127) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(127) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(128) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(128) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(128) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(128) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(129) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(129) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(129) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(129) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(131) : error C2065: 'ofstream' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(131) : error C2146: syntax error : missing ';' before identifier 'abc'
1>c:\tcwin45\bin\finalpro.cpp(131) : error C2065: 'abc' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(132) : error C2228: left of '.open' must have class/struct/union
1> type is ''unknown-type''
1>c:\tcwin45\bin\finalpro.cpp(132) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(132) : error C2065: 'out' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(132) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(132) : error C2065: 'ate' : undeclared identifier
1>c:\tcwin45\bin\finalpro.cpp(135) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(135) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(135) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(135) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(136) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(136) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(136) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(136) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(137) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(137) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(137) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(137) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(138) : error C2653: 'ios' : is not a class or namespace name
1>c:\tcwin45\bin\finalpro.cpp(138) : error C3861: 'setiosflags': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(138) : error C3861: 'setw': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(138) : error C3861: 'setprecision': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(140) : error C2228: left of '.close' must have class/struct/union
1> type is ''unknown-type''
1>c:\tcwin45\bin\finalpro.cpp(172) : error C3861: 'clrscr': identifier not found
1>c:\tcwin45\bin\finalpro.cpp(177) : error C2065: 'cin' : undeclared identifier
1>Build log was saved at "file://c:\Users\Anshul Agarwal\Documents\Visual Studio 2005\Projects\final project\final project\Debug\BuildLog.htm"
1>final project - 54 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

A lot of these look like maybe you either have a namespace problem or you have #include statements with ".h" on them that shouldn't have them. If you have something like this:

#include <iostream.h>

try changing it to:

#include <iostream>

Also, it can't figure out what cin and cout and other commands are, so maybe you don't have

using namespace std;

at the top. There are a lot of good threads on Daniweb regarding the potential drawbacks of using that line, but it may be worth sticking that line at the top to see if it compiles now. You can also do a global replace and change cout to std::cout everywhere in the project, and do the same with your other "undeclared identifiers". You can do that if you don't want to use using using namespace std; . Sometimes it's easier to just stick using namespace std; at the top. Give those suggestions a try and see what happens.

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.