Compile C # with Geany in Windows
is an interesting Geany text editor. Perhaps with fewer opportunities than others such as Notepad + +, but still very powerful and reasonably easy to use.
Thursday, November 4, 2010
Linsey Dawn Mckenzie Sunday Sport
One of the major advantages (for my taste) vs Notepad + + is that it is easy to compile and run programs created in different programming languages \u200b\u200bwithout leaving the editor. Yes ... sometimes you have to tune it a bit:
For C #, comes preconfigured to compile with Mono , but this in Windows is less immediate than it might seem. Let's see why and how to fix it:
related settings C # is in a file called "filetypes.cs", located in the folder "data" Geany (In "C: \\ Program Files \\ Geany \\ data \\ filetypes.cs" if we do a typical installation on Windows XP). We can open that file from within Geany.
The last two lines of that file should be something like:
compiler = mcs / t: winexe "% f" / r: System, System.Drawing
run_cmd = mono "% e . exe "
The problem is that these two lines waiting to compile sources in C # using Mono, which is immediate in Linux, but it is not so trivial in Windows, because it would change the basic configuration of Windows, so folder that is Mono one of the system's search folders.
There is a simple alternative, if you have installed any version of the platform "dot net", which is almost certain if we have any Service Pack for Windows XP, or if you have a newer Windows version: can use the compiler that is included with the platform .
First we have to find it: we started our drive C (or have installed the operating system), we entered the Windows folder, and it should be a subfolder called "Microsoft.net", which in turn contains another folder called "Framework" and in it we find several subfolders, one for each version of "dot net" that we have installed:
For example, this image shows a basic version of Windows XP, which has the v1 versions .0.3705 and v1.1.4322. We go to any of those folders (preferably a recent, with a higher version number) and check if it is the compiler, a file called "CSC."
If so, we know what the full path of the compiler, something like
C: \\ WINDOWS \\ Microsoft.NET \\ Framework \\ v1.1.4322 \\ csc.exe
(no need to memorize it, you can copy and paste from the address bar of our browser).
Then we can modify the configuration two lines that interest us: to compile sufficient to indicate the previous route followed by the name of our source, and release the resulting executable will use the name of our source ending in " . exe "and:
compiler = C: \\ WINDOWS \\ Microsoft.NET \\ Framework \\ v1.1.4322 \\ csc.exe"% f "
run_cmd ="% e.exe "
Of course, other options of Geany that seem comfortable to me are:
- In Edit / Preferences / Editor / Indent: width 4 or 2, but always filled with spaces instead of Tabs.
- In Edit / Preferences / Editor / Display: marker of activated long lines in column 80, to keep out of position when you print, if I use old sources or from other programmers, who may use the tab character instead of spaces also mark the option "Show white space."
- I also find it convenient to change tabs to spaces automatically and spaces are erased at the end of each line Once you save a file, which you can get from Edit / Preferences / Files
For changes to be effective, we can exit the editor and re-enter or use the "Reload Settings" menu ( This serves the appearance, not to the "new compiler" for fonts in C #, for that we do need to leave the editor and reopen it.)
Happy coding! ;-)
(All this is tested with version 0.19.1 on Windows XP and Windows 7)
Subscribe to:
Posts (Atom)