#include <iostream>
#include <math.h>
using namespace std;
int main()
{
    int64_t sum=0, c=-1, li[1000000];
    bool flag = 1;
    for(int i=2; i<=2000000; i++)
    {
        flag = 1;
        for(int j = 0; j<c; j++)
        {
            if (i%li[j]==0)
            {
                flag = 0;
                break;
            }
        }
        if(flag)
        {
            sum += i;
            li[++c] = i;
        }
    }
    cout<<"done"<<endl;
    cout<<sum;             // This line causes the program to crash.
    return 0;
}
Check out the code above. The "cout<
Was using Code::Blocks v13.12, GNU GCC compiler, default settings. Also, I'm a newbie, both to coding and StackOverflow :)
 
    