Thread: mysterious invalid function errors

  1. #1

    mysterious invalid function errors

    I compiled my program and when I tryed to run it, windows popped up one of the "Program needs to shut down, invalid function" thing. So I tried to rebuild all and THEN run it. Same thing happened. The game won't even start, it just pops the thing up. I didn't make any changes to int main() at all, and it just won't even start.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Using my ESP powers now...yes...I..see..the bug...it's...it's...damn! I guess you'll have to be a little more specific - my psychic powers are drained at the moment.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    okay

    I got this program.

    I added some functions to the program, but I never call them. It doesn't effect int main() at all. But now it just comes up with one of those

    "terminus.exe has encountered a problem and needs to close. We are sorry for the inconvenience"

    errors.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Copy the offensive code into a word processor and delete the text from the sourcecode. Recompile and run, and if the errors still exist, post back. Otherwise, that sound a little well, mysterious, and you may need to consult a paranormal expert.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  5. #5
    I just did. And I also tryed to start a new project and put all the source back into it, and the same thing happened. So I tested another project to see if the compiler is at fault, and that program ran fine.

  6. #6
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    so you did call a paranormal expert? Maybe I should give em' a ring, I'm having problems with Textris myself, I bet the code is haunted

  7. #7
    here's his number:

    (555) 555-5555

  8. #8
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    I'd suggest you call them then - or get a new compiler
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  9. #9
    something else happened

    My exe file used to be over 200 k, now it suddenly shrank down to 91k.

  10. #10
    okay that part was just because of I unchecked dubugging info

  11. #11
    okay, I tried restarting the computer. I tried using Cygwin instead of MingW32. Both didn't work.

    It doesn't even start the program. I took EVERYTHING out of main, and switched it just to return 0, and the same thing happend.

  12. #12
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    I suggest posting the malicious code you added...and in the future, back up versions often, everytime you make any change after a running program has been created. Beyond that, try MSVC if you have some cash.....lol, is it a win-dos or a win32 app?
    PHP and XML
    Let's talk about SAX

  13. #13
    Win32 using Allegro as the API.

    And I don't even have the money to buy MSVC.

    And it's not a problem with the Allegro DLL file, because all my other allegro programs run fine.

  14. #14
    this is the only thing I added
    Code:
    void map::draw()
    {
     blit(MapBuffer,DoubleBuffer,camerax,cameray,0,0,800,600);
    }
    
    void map::animate()
    {
     for (int lay=0; lay < 3; lay++)
     {
      for (int row=0; row < width; row++)
      {
       for (int col=0; col < height; col++)
       {
        if (tiles[col][row][lay].AniFrame < 3) 
         tiles[col][row][lay].AniFrame++;
        else
         tiles[col][row][lay].AniFrame=0;
         
        int tile_to_blit;
        switch (GetTileType(col,row,lay))
        {
         case 0:
          tile_to_blit=TILE_GRASS;
          break;
         case 1: 
          tile_to_blit=TILE_DIRTYWALL;
          break;     
         case 2:
          tile_to_blit=TILE_FLOOR;
          break;
         case 3:
          switch (tiles[col][row][lay].AniFrame)
          {
           case 0:
            tile_to_blit = TILE_GRASS;
            break;
           case 1:
            tile_to_blit = TILE_DIRTYWALL;
            break;
           case 2:
            tile_to_blit = TILE_FLOOR;
            break;
           default:
            tiles[col][row][lay].AniFrame = 0;
            tile_to_blit = TILE_GRASS;
          }
          break;
         default:
          tile_to_blit=-1;
        }
        if (tile_to_blit != -1)
         blit((BITMAP*)TileGraphics[tile_to_blit].dat,MapBuffer,0,0,col*40,row*40,40,40);
       }
      }
     } 
    }
    I already tried commenting all that out, and the same thing happens.

  15. #15
    okay, now it's throwing errors at me everytime I try to use fstream. They are linker errors, saying that the member functions I am trying to call aren't there!

    infile >> buffer;

    gives me a linker error


    [Linker error] undefined reference to `istream:perator>>(char *)'

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM