Actually, this does not work in the Arduino IDE for me either with the original main.ino and second.ino files shown above.
main.ino
second.ino
Can you show an example of multiple ino files with global variables in the style that you do?