The references to “MS VC++” suggest that you are running under Windows. Be sure that you are setting optionsolvergurobi; when calling Gurobi from the shell and also from the IDE.
Then, since you are able to invoke two different versions of Gurobi, you must have two different gurobi.exe files on your computer. Use the Windows search feature to find your gurobi.exe files, and rename or delete the older one. (The windows command “gurobi -v” will show you the version.)
Finally, be sure that AMPL folder is properly configured. It should contain ampl.exe, the new gurobi.exe, and an “amplide” folder that contains amplide.exe.