Thread: result is different when program is run under MinGW compiler.

  1. #1
    Registered User jaro's Avatar
    Join Date
    Mar 2006
    Location
    In my Parent House
    Posts
    34

    result is different when program is run under MinGW compiler.

    Hi to all!,

    I've created a simple program the connect to a database (DB2) , using embeded sql in C . I've used MVC6 in creating the program.

    Then I've decided to transfer this to a different compiler (MinGW). Well tranfering to a different compiler is quite hard than I've first thought, it took me days to compile a simple "hello world" program. After I got the hang on using the compiler (using an IDE, I'm using Eclipse 3.2), I decided to migrate the connect to a database program I've created.
    I was able to compile the program without any error and warning , the problem is when I try to run the program (thru IDE and running the .exe file created) I'm getting a popup error message saying:

    The instruction at "0x000083ac" referenced memory at "0x000083ac". The memory could not be "read".
    What is causing this kind of error? I'm failry new in using the MinGW compiler and the IDE I'm using.

    My OS is Win2k , IDE I'm using is Eclipse 3.2, MinGW version is 3.4.2

    Any help would be much appreciated.

    Regards,
    Jaro

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    It's hard to say what's going on for sure.

    If you have a debugger, you should be able to work out the context of where the exception occurs.

    One common thing is using uninitialised memory, which you can detect by turning on more warnings when you're compiling with MinGW.
    Say
    -W -Wall -O2

    Another common problem is small buffer overruns, like forgetting to add 1 when you allocate space for a string.


    > Well tranfering to a different compiler is quite hard than I've first thought
    That's usually the hardest one to do, moving from compiler 1 to compiler 2
    Compiler 2 to compiler 3 usually goes a lot easier as a lot of the portability issues will have already been resolved.

    It's useful to practice coding with several different compilers at the same time just to get a feel for the issues you're likely to face if you're going to be doing a lot of this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User jaro's Avatar
    Join Date
    Mar 2006
    Location
    In my Parent House
    Posts
    34
    Thanks for the reply!

    I was able to find the line that causing the error.

    the line is this.
    Code:
    EXEC SQL CONNECT TO :dbName user:userId using:password ;
    The program is a embeded sql in C type of program. As I've said I'm pretty much new in using the MinGW , btw I've upgraded my version from 3.4.2 to 3.4.5.


    does anyone have any idea why I'm getting this type of error?

    regards,
    Jaro

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help on making program run more efficiently
    By peeweearies in forum C Programming
    Replies: 2
    Last Post: 03-23-2009, 02:01 AM
  2. How to time how long a program takes to run?
    By advancedk in forum C Programming
    Replies: 2
    Last Post: 08-18-2008, 07:50 PM
  3. Help me with my basic program, nothing I create will run
    By Ravens'sWrath in forum C Programming
    Replies: 31
    Last Post: 05-13-2007, 02:35 AM
  4. Replies: 3
    Last Post: 07-11-2005, 03:07 AM
  5. Cannot run program in background?
    By registering in forum Linux Programming
    Replies: 3
    Last Post: 06-16-2003, 05:47 AM