Page 1 of 1

Map Problem

Posted: Wed Jun 21, 2006 2:53 am
by TISARKER
When I compiled the following code
Then 77 warnings shows.
How can I remove those warnings.

Here is the code

Code: Select all

#include<stdio.h>
#include<ctype.h>
#include<string>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

map<string,int> M;

void main()
{

}

Posted: Wed Jun 21, 2006 4:29 am
by Cho
Try this code:

Code: Select all

#include<cstdio> 
#include<cctype> 
#include<string> 
#include<algorithm> 
#include<vector> 
#include<map> 

using namespace std; 

map<string,int> M; 

int main() 
{ 
   return 0;
}
By the way, you should post in the C++ forum.

Posted: Wed Jun 21, 2006 11:31 pm
by TISARKER
By the way, you should post in the C++ forum.
Ok Cho, I will not try to mistake this type of error.

By the way, I use Visual c++6.0.After compiling ur code two error massage shows.
1.Cannot open include file: 'cstdio.h'
2.Cannot open include file: 'cctype.h'

Does Visual c++ support above two files.?

What can I do now?.
Please help me. :(

Posted: Thu Jun 22, 2006 8:40 am
by shamim
V C++ does support <cstdio>,

but you should not include the .h after the header name.

Posted: Thu Jun 22, 2006 3:42 pm
by TISARKER
Yet 77 warnings shows.
What can I do now.?

Posted: Thu Jun 22, 2006 5:32 pm
by chunyi81
What Cho means is that #include <cstdio> but not #include <cstdio.h>

You don't have to put .h for C++ headers

Posted: Thu Jun 22, 2006 11:15 pm
by TISARKER
chunyi81 wrote:What Cho means is that #include <cstdio> but not #include <cstdio.h>

You don't have to put .h for C++ headers
Ok I have understood my mistake.
Sorry for my mistake :P .

But yet 77 warnings shows after compilling Cho's given code. :o
What is the reason.? :roll:

Posted: Thu Jun 22, 2006 11:38 pm
by mf
IIRC you have to include /EHsc option to make Microsoft's compiler happy.
i.e. use "cl /EHsc filename.cpp" for compilation.

Posted: Thu Jun 22, 2006 11:46 pm
by TISARKER
mf wrote:IIRC you have to include /EHsc option to make Microsoft's compiler happy.
i.e. use "cl /EHsc filename.cpp" for compilation.
Hi mf, Please clarify it with example.

Posted: Fri Jun 23, 2006 12:36 am
by mf
Well, "cl /EHsc filename.cpp" was an example!
That's what you should type, if you use Miscrosoft Visual C++'s command line compiler.

If you use IDE: choose Project->Settings->C/C++ tab, replace everything in "Project Options" with "/EHsc /c".

Posted: Fri Jun 23, 2006 3:16 am
by TISARKER
Thnks Thnks .......................Thnks :D :D :D
Hi misof,
Can u briefly clarify and explain me, What was written in 77 warnings?.
I want to tell what do 77 warnings mean?.
Sorry for my poor English.

Posted: Fri Jun 23, 2006 4:42 pm
by nukeu666
if you want to code for OJ, you should stick to gcc/g++

STL warnings

Posted: Sun Jun 25, 2006 1:18 pm
by Riyad
if you are using visual C++ just add the following line in the begining of the code :

# pragma warning ( disable : 4786 )

this line will cause the STL warnings to vanish but the errors will be notified ......