There are two things that spring to mind when you mention code that works in the IDE but does not compile.
The first is arrays: the IDE will allow you to use undeclared arrays. It will impose a default dimension of [tt](0 TO 10)[/tt]. However, the compiler makes no such allowance. You must explicitly declare all arrays using [tt]DIM[/tt] statements as follows:
[tt]
DIM myArray%(0 TO 10)
[/tt]
Strictly speaking, the lower bound does not need to be specified. It will default to 0 unless you use [tt]OPTION BASE 1[/tt], in which case it will default to 1. However, it is because of exactly this that I believe it is a good coding practice to always specify the lower bound for arrays. Especially if you are worried about generating errors.
The other thing that springs to mind is also arrays. By default, all data items are "static", which means that they are preallocated from the data segment before your program runs. The addresses are then stored inside the executable file. The data segment, however, has a limited size -- much more limited than the memory available for variables inside the IDE. If you use large arrays and/or many of them, the compiler may run out of space to put things. You can make the compiler output code that allocates memory the same way that the IDE does by putting the following line of code at the top of your program:
[tt]
'$DYNAMIC
[/tt]
On a similar note, if your program is exceedingly large, there can also be too much code to fit into the code segment. Your program gets one code segment per module. This means that you can break your program up into multiple modules to get more memory for code. To do this, look into the "Create File", "Load File" and "Unload File" items in the "File" menu of QuickBASIC. They allow you to make a project that consists of multiple .BAS files. Be warned, though: I have found data sharing through the use of [tt]COMMON SHARED[/tt] variables to be very flaky in practice. When I make such large projects, I rely only on parameters to functions.