The function addColumn(String) does not exist

I have tried this code in both 3.5.4 and 4.0.1 and they both executed without any error messages being generated.

Perhaps someone else can try 4.1.1 as I have not downloaded it yet.