Problem with g++ 4.8.1 with map (hash table)

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with g++ 4.8.1 with map (hash table)

Hisham Sueyllam
I wrote a very simple program using map  in c++. The program works fine in CodeBlocks and Dev-C++ using the gnu compiler 4.8.1 supplied with them, but when compiled in the command window using the same version supplied with mingw distribution through the mingw-get it crashes... Any clues?

Here is the program:

====================================================Cut here==============================================
#include <string.h>
#include <iostream>
#include <map>
#include <utility>

using namespace std;

int main()
{
   map<string, int> Employees;

   // Examples of assigning Map container contents

   // 1) Assignment using array index notation
   Employees["Mike C."] = 5234;
   Employees["Charlie M."] = 3374;

   // 2) Assignment using member function insert() and STL pair
   Employees.insert(std::pair<string,int>("David D.",1923));
 
   // 3) Assignment using member function insert() and "value_type()"
   Employees.insert(map<string,int>::value_type("John A.",7582));

   // 4) Assignment using member function insert() and "make_pair()"
   Employees.insert(std::make_pair("Peter Q.",5328));

   cout << "Map size: " << Employees.size() << endl;

   for( map<string, int>::iterator ii=Employees.begin(); ii!=Employees.end(); ++ii)
   {
       cout << (*ii).first << ": " << (*ii).second << endl;
   }
}

=========================================Cut here========================================================
hisham...

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem with g++ 4.8.1 with map (hash table)

David Gressett
Hisham Sueyllam wrote:

> I wrote a very simple program using map in c++. The program works fine in CodeBlocks and Dev-C++
>  using the gnu compiler 4.8.1 supplied with them, but when compiled in the command window using
> the same version supplied with mingw distribution through the mingw-get it crashes... Any clues?

... source code snipped out ...

It worked for me with my 4.8.3 and 4.9.2 command-line compilations. What version
of the runtime and win32 API are you using? V4 has major problems. If you are using those,
you should go back to V3 and build the program again.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem with g++ 4.8.1 with map (hash table)

Keith Marshall
On 01/11/14 19:27, David Gressett wrote:

> Hisham Sueyllam wrote:
>
>> I wrote a very simple program using map in c++. The program works fine in CodeBlocks and Dev-C++
>>  using the gnu compiler 4.8.1 supplied with them, but when compiled in the command window using
>> the same version supplied with mingw distribution through the mingw-get it crashes... Any clues?
>
> ... source code snipped out ...
>
> It worked for me with my 4.8.3 and 4.9.2 command-line compilations. What version
> of the runtime and win32 API are you using? V4 has major problems. If you are using those,
> you should go back to V3 and build the program again.

FWIW, it also WJFFM when I compile it with my self-built mingw32-g++
Linux hosted cross compilers, (both v4.8.1 and v4.8.2), with either of
mingwrt-4.0.0/w32api-4.0.0, or mingwrt-3.20/w32api-3.17; in all cases,
the resultant executable works just fine, when run in VirualBox/Win7.

Hisham, there have been known issues with Earnie's g++-4.8.1 builds; you
might like to try my crossed-native gcc-4.8.2 experimental build
instead, (although you will need to install it manually):
https://sourceforge.net/projects/mingw/files/MinGW/Base/gcc/Version4/experimental/

see also:
https://sourceforge.net/p/mingw/bugs/2108/?limit=10&page=5#482e

David, I never promoted my gcc-4.8.2 builds for installation using
mingw-get, because I was never able to build the crossed-native ada
component, (even though the Linux hosted cross-ada does seem to work
okay).  It would be good if we could get your 4.9.2 build integrated
into mingw-dist, so that it can become the current version which is
delivered by mingw-get; I'll need to follow that up with you, on the
developers' mailing list.

--
Regards,
Keith.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem with g++ 4.8.1 with map (hash table)

Joost Kraaijeveld
In reply to this post by Hisham Sueyllam
On vr, 2014-10-31 at 19:06 -0700, Hisham Sueyllam wrote:
> I wrote a very simple program using map  in c++. The program works
> fine in CodeBlocks and Dev-C++ using the gnu compiler 4.8.1 supplied
> with them, but when compiled in the command window using the same
> version supplied with mingw distribution through the mingw-get it
> crashes... Any clues?
What does a "crash" mean? No output? Windows crash popup? Random output?

If I use the mingw-get version it compiles and runs just fine.


------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem with g++ 4.8.1 with map (hash table)

Peter Rockett
In reply to this post by Hisham Sueyllam
On 01/11/14 02:06, Hisham Sueyllam wrote:
> I wrote a very simple program using map  in c++. The program works fine in CodeBlocks and Dev-C++ using the gnu compiler 4.8.1 supplied with them, but when compiled in the command window using the same version supplied with mingw distribution through the mingw-get it crashes... Any clues?
>
> .../snip
Do you have another, older version of MinGW installed? If so, you should
check the path environment variable. (I had a colleague with exactly the
same problem you describe and it turned-out to be that the DOS box
version was trying to load incompatible DLLs from an older MinGW using
the incorrectly-set path variable; the IDE seemed to find the correct
DLLs some other way. Have to confess that I didn't sort the problem for
my colleague - someone else spotted the path issue.)

P.


------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem with g++ 4.8.1 with map (hash table)

Hisham Sueyllam
In reply to this post by Hisham Sueyllam
Attached is the screen capture of the window I get....
hisham...

--------------------------------------------
On Sun, 11/2/14, Joost Kraaijeveld <[hidden email]> wrote:

 Subject: Re: [Mingw-users] Problem with g++ 4.8.1 with map (hash table)
 To: [hidden email]
 Date: Sunday, November 2, 2014, 3:55 PM
 
 On vr, 2014-10-31 at
 19:06 -0700, Hisham Sueyllam wrote:
 >
 I wrote a very simple program using map  in c++. The
 program works
 > fine in CodeBlocks and
 Dev-C++ using the gnu compiler 4.8.1 supplied
 > with them, but when compiled in the
 command window using the same
 > version
 supplied with mingw distribution through the mingw-get it
 > crashes... Any clues?
 What does a "crash" mean? No output?
 Windows crash popup? Random output?
 
 If I use the mingw-get version it compiles and
 runs just fine.
 
 
 ------------------------------------------------------------------------------
 _______________________________________________
 MinGW-users mailing list
 [hidden email]
 
 This list observes the
 Etiquette found at
 http://www.mingw.org/Mailing_Lists.
 We ask that you be polite and do the same. 
 Disregard for the list etiquette may cause your account to
 be moderated.
 
 _______________________________________________
 You may change your MinGW Account Options or
 unsubscribe at:
 https://lists.sourceforge.net/lists/listinfo/mingw-users
 Also: mailto:[hidden email]?subject=unsubscribe
------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe

Untitled.jpg (35K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem with g++ 4.8.1 with map (hash table)

Hisham Sueyllam
In reply to this post by Peter Rockett
Well I had an older version that I replaced. The older version was not working at all.. I will try on a different computer that did not have an older version and let you know what happens. If that is the problem, then I am not sure how to fix the path problem. However you should note that when I call the g++4.8.1 that comes with codeBlocks using its full pathname c:\program files\codeblocks\mingw\bin then the program compiles and runs fine in the command window.
hisham...

--------------------------------------------
On Sun, 11/2/14, Peter Rockett <[hidden email]> wrote:

 Subject: Re: [Mingw-users] Problem with g++ 4.8.1 with map (hash table)
 To: [hidden email]
 Date: Sunday, November 2, 2014, 7:15 PM
 
 On 01/11/14 02:06, Hisham
 Sueyllam wrote:
 > I wrote a very simple
 program using map  in c++. The program works fine in
 CodeBlocks and Dev-C++ using the gnu compiler 4.8.1 supplied
 with them, but when compiled in the command window using the
 same version supplied with mingw distribution through the
 mingw-get it crashes... Any clues?
 >
 > .../snip
 Do you have
 another, older version of MinGW installed? If so, you should
 
 check the path environment variable. (I had
 a colleague with exactly the
 same problem
 you describe and it turned-out to be that the DOS box
 version was trying to load incompatible DLLs
 from an older MinGW using
 the
 incorrectly-set path variable; the IDE seemed to find the
 correct
 DLLs some other way. Have to
 confess that I didn't sort the problem for
 my colleague - someone else spotted the path
 issue.)
 
 P.
 
 
 ------------------------------------------------------------------------------
 _______________________________________________
 MinGW-users mailing list
 [hidden email]
 
 This list observes the
 Etiquette found at
 http://www.mingw.org/Mailing_Lists.
 We ask that you be polite and do the same. 
 Disregard for the list etiquette may cause your account to
 be moderated.
 
 _______________________________________________
 You may change your MinGW Account Options or
 unsubscribe at:
 https://lists.sourceforge.net/lists/listinfo/mingw-users
 Also: mailto:[hidden email]?subject=unsubscribe
 

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem with g++ 4.8.1 with map (hash table)

Joost Kraaijeveld
In reply to this post by Hisham Sueyllam
On zo, 2014-11-02 at 19:29 -0800, Hisham Sueyllam wrote:
> Attached is the screen capture of the window I get....
> hisham...

Please check if there is another version of libstdc++6.dll on your
system. If so, make sure that MinGW's version in the first version in
your path, if possible.


------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Problem with g++ 4.8.1 with map (hash table)

Hisham Sueyllam
Thanks to all, it was the stupid path, I fixed it removed the unwanted paths and put the c:\mingw\bin at the start of the path and it is now working fine...
hisham...

--------------------------------------------
On Mon, 11/3/14, Joost Kraaijeveld <[hidden email]> wrote:

 Subject: Re: [Mingw-users] Problem with g++ 4.8.1 with map (hash table)
 To: "MinGW Users List" <[hidden email]>
 Date: Monday, November 3, 2014, 7:12 AM
 
 On zo, 2014-11-02 at
 19:29 -0800, Hisham Sueyllam wrote:
 >
 Attached is the screen capture of the window I get....
 > hisham...
 
 Please check if there is another version of
 libstdc++6.dll on your
 system. If so, make
 sure that MinGW's version in the first version in
 your path, if possible.
 
 
 ------------------------------------------------------------------------------
 _______________________________________________
 MinGW-users mailing list
 [hidden email]
 
 This list observes the
 Etiquette found at
 http://www.mingw.org/Mailing_Lists.
 We ask that you be polite and do the same. 
 Disregard for the list etiquette may cause your account to
 be moderated.
 
 _______________________________________________
 You may change your MinGW Account Options or
 unsubscribe at:
 https://lists.sourceforge.net/lists/listinfo/mingw-users
 Also: mailto:[hidden email]?subject=unsubscribe
 

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe