0

I have encountered the typical No Entry Point Personality V0 error before and worked around it with: -fno-exceptions. Although this time when I use the workaround cmd crashed and only runs the first cin >> line of the program.

However, I can run the program no problem in MSYS.

I compiled with:

g++ ReturnPointer.cpp -o ReturnPointer.exe (gave error)

g++ ReturnPointer.cpp -o ReturnPointer.exe -fno-exceptions (runs: MSYS Shell Only)


    #include <iostream> 

short factor(int, int*, int*);

int main()
{
    int number, squared, cubed;
    short error;

    std::cout << "Enter a number (0 - 20 ): ";
    std::cin >> number;

    error = factor(number, &squared, &cubed);

    if (!error)
    {
        std::cout << "number: " << number << "\n";
        std::cout << "square: " << squared << "\n";
        std::cout << "cubed: " << cubed << "\n";
    }
    else
        std::cout << "Error encountered!!\n";

    return 0;
}

short factor(int n, int* pSquared, int* pCubed)
{
    short value = 0;
    if (n > 20)
    {
        value = 1;
    }
    else
    {
            *pSquared = n * n;
            *pCubed   = n * n * n;
        value = 0;
    }
    return value;
}

Granted, this isn't the end of the world. I am just expanding my knowledge on an area of C++ that trips me up a lot. Although, if I were to ever use pointers in this manner in a larger program...that would turn into a mess.

I would just like to know what needs to be done or what I am missing to run this in CMD.

Community
  • 1
  • 1
Proteu5
  • 1
  • 1
  • Works perfectly fine on my side, `g++4.9` `OS X 10.9.2`. No warnings (`-Wall, -Wextra, -pedantic`) – vsoftco Jun 02 '14 at 20:59
  • The program looks OK to me, this must be a problem with your compiler installation – M.M Jun 02 '14 at 21:37
  • maybe [this](http://stackoverflow.com/questions/18668003/the-procedure-entry-point-gxx-personality-v0-could-not-be-located-in-the-dnyam) is the problem? – M.M Jun 02 '14 at 21:38
  • Hrmmm, it must be at this point. Just short of a re-install, I can't figure it out. I'll try a new virtual machine. This is weird. – Proteu5 Jun 03 '14 at 21:38
  • Thank You @Matt McNabb! That Solved It! I am new to StackOverflow! Is there a point system to reward solutions? Re: Needed libstdc++-6.dll – Proteu5 Aug 03 '14 at 01:37
  • @Proteu5 normally yes, however instead of me repeating the answer on the linked thread , this question should just be linked to that thread – M.M Aug 03 '14 at 01:51
  • Ahh Okay, Thanks! I am learning. – Proteu5 Aug 03 '14 at 02:04

0 Answers0