Map Problem

Post about everything you want - even if it is not related to programming or this site.

Moderator: Board moderators

Post Reply
TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

Map Problem

Post by TISARKER » Wed Jun 21, 2006 2:53 am

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()
{

}
Mr. Arithmetic logic Unit

User avatar
Cho
A great helper
Posts: 274
Joined: Wed Oct 20, 2004 11:51 pm
Location: Hong Kong

Post by Cho » Wed Jun 21, 2006 4:29 am

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.

TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

Post by TISARKER » Wed Jun 21, 2006 11:31 pm

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. :(
Mr. Arithmetic logic Unit

User avatar
shamim
A great helper
Posts: 498
Joined: Mon Dec 30, 2002 10:10 am
Location: Bozeman, Montana, USA

Post by shamim » Thu Jun 22, 2006 8:40 am

V C++ does support <cstdio>,

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

TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

Post by TISARKER » Thu Jun 22, 2006 3:42 pm

Yet 77 warnings shows.
What can I do now.?
Last edited by TISARKER on Thu Jun 22, 2006 11:32 pm, edited 1 time in total.
Mr. Arithmetic logic Unit

chunyi81
A great helper
Posts: 293
Joined: Sat Jun 21, 2003 4:19 am
Location: Singapore

Post by chunyi81 » Thu Jun 22, 2006 5:32 pm

What Cho means is that #include <cstdio> but not #include <cstdio.h>

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

TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

Post by TISARKER » Thu Jun 22, 2006 11:15 pm

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:
Mr. Arithmetic logic Unit

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf » Thu Jun 22, 2006 11:38 pm

IIRC you have to include /EHsc option to make Microsoft's compiler happy.
i.e. use "cl /EHsc filename.cpp" for compilation.

TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

Post by TISARKER » Thu Jun 22, 2006 11:46 pm

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.
Mr. Arithmetic logic Unit

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf » Fri Jun 23, 2006 12:36 am

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".

TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

Post by TISARKER » Fri Jun 23, 2006 3:16 am

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.
Mr. Arithmetic logic Unit

nukeu666
New poster
Posts: 44
Joined: Sun Feb 13, 2005 1:13 am
Location: India
Contact:

Post by nukeu666 » Fri Jun 23, 2006 4:42 pm

if you want to code for OJ, you should stick to gcc/g++
google

User avatar
Riyad
Experienced poster
Posts: 131
Joined: Thu Aug 14, 2003 10:23 pm
Location: BUET
Contact:

STL warnings

Post by Riyad » Sun Jun 25, 2006 1:18 pm

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 ......
HOLD ME NOW ,, I AM 6 FEET FROM THE EDGE AND I AM THINKIN.. MAY BE SIX FEET IS SO FAR DOWN

Post Reply

Return to “Off topic (General chit-chat)”