Single file compiling

Top  Previous  Next

While projects may be useful for larger programs they are a bit cumbersome if your program only consists of one source file and you want to quickly make and test changes to your code. The Emergence BASIC IDE is dual mode in that it allows compiling a single file directly to an executable or DLL.

Steps to use single file mode

1.Make sure there isn't a project open by selecting the File menu and choosing Close Project
2.Open an existing EBASIC source file by selecting the File menu and choosing Open. Or create a new source file by selecting the File menu and choosing New->Emergence source file
3.Select the Build menu and choose Build Single. If you created a new source file you will be prompted to save first before compiling. This will display the Executable Options dialog.
4.Choose your executables path and name, any icon to use, the target build type, whether or not you want a debugging executable and click the Create button.
5.Observe any compiler, assembler or linker error messages in the Output Window of the IDE. Correct any errors and recompile as necessary. As in project mode you can double click on any error occurring in an EBASIC source file to highlight the offending line.

 

Executing your program

After a successful build of the program you can test the resulting executable, if any,  by selecting the Build menu and choosing Execute ... . Alternately the program can be executed by clicking the green 'Go' button on the tool bar.

Notes

The only resource available for use in single file mode is the programs icon selected with the Executable Options dialog.

It is not necessary to use $main in single file mode. The compiler automatically determines the point of execution as there is only one file. The $main keyword will be silently ignored.

Any options selected in the Executable Options dialog will be remembered for the next compile. The options are stored in a separate file with the source file name and a ".opts" extension in the same directory as the source file. If this file is deleted, or doesn't yet exist, the Executable Options dialog will display default values.

Be sure to choose the proper output type. If you select a Console type for a Windows program you will get an error message about a missing _window_list variable from the linker. This error is normal and means you need to change the output type to Windows.

You can still use the $include command in your single file. Use this to bring in additional source files.

See Also: Using Projects