This tour undergoes common operations for Cmajor projects.
Select File | New | Project... menu item in Visual Studio.
The New Project dialog opens...
You can create either a console application or library project. Let's create a console application with name PrintDate into C:\cmajor\projects folder.
Now the PrintDate project looks like this:
Right-click the PrintDate project and select Add | New Item.... The New Item dialog opens. Let's create a Cmajor source file with name PrintDate.cm...
Let's give the PrintDate.cm file the following content:
Before building the project we set the build verbosity to Normal by selecting Tools | Options... | Projects and Solutions | Build and Run | MSBuild project build output verbosity to Normal to see some build output messages...
Build the project by selecting Build | Build Solution menu item:
The build succeeded, so we can start debugging the project by first setting a break point:
Now run the project by selecting Debug | Start Debugging menu item or pressing F5:
Right-click the date variable and select QuickWatch. A QuickWatch dialog appears showing valid data for the date variable...
By setting another break point to the return statement and clicking the Continue button, we can see the output of the program...
Clicking the Continue button once again the program exits with exit code 0...
The C:\cmajor\projects folder contains an EditorConfig file that defines properties for created source files under its subfolders. Here's the default .editorconfig file used for Cmajor source files.
To see that output of non-Latin characters works, we enter another line to the program that says "good morning" in finnish:
A hexdump of the PrintDate.cm shows that finnish ä-letters have proper utf-8 encoding C3 A4...
C:/cmajor/projects/PrintDate/PrintDate/PrintDate.cm: 00000000: 75 73 69 6E 67 20 53 79 - 73 74 65 6D 3B 0D 0A 0D |using System; | 00000010: 0A 69 6E 74 20 6D 61 69 - 6E 28 29 0D 0A 7B 0D 0A | int main() { | 00000020: 20 20 20 20 44 61 74 65 - 20 64 61 74 65 20 3D 20 | Date date = | 00000030: 47 65 74 43 75 72 72 65 - 6E 74 44 61 74 65 28 29 |GetCurrentDate()| 00000040: 3B 0D 0A 20 20 20 20 43 - 6F 6E 73 6F 6C 65 2E 4F |; Console.O| 00000050: 75 74 28 29 20 3C 3C 20 - 22 47 6F 6F 64 20 6D 6F |ut() << "Good mo| 00000060: 72 6E 69 6E 67 21 20 54 - 6F 64 61 79 20 69 73 20 |rning! Today is | 00000070: 22 20 3C 3C 20 64 61 74 - 65 20 3C 3C 20 22 2E 22 |" << date << "."| 00000080: 20 3C 3C 20 65 6E 64 6C - 28 29 3B 0D 0A 20 20 20 | << endl(); | 00000090: 20 43 6F 6E 73 6F 6C 65 - 2E 4F 75 74 28 29 20 3C | Console.Out() <| 000000A0: 3C 20 22 48 79 76 C3 A4 - C3 A4 20 68 75 6F 6D 65 |< "Hyv huome| 000000B0: 6E 74 61 21 20 54 C3 A4 - 6E C3 A4 C3 A4 6E 20 6F |nta! T n n o| 000000C0: 6E 20 22 20 3C 3C 20 64 - 61 74 65 20 3C 3C 20 22 |n " << date << "| 000000D0: 2E 22 20 3C 3C 20 65 6E - 64 6C 28 29 3B 0D 0A 20 |." << endl(); | 000000E0: 20 20 20 72 65 74 75 72 - 6E 20 30 3B 0D 0A 7D 0D | return 0; } | 000000F0: 0A - | | 000000F1;
By setting a break point, running the program and looking at the console window we see that the output encoding is also valid...
If you get the following error, build your project or solution before trying to run or debug: