14.02.2013, 09:42
(
Last edited by Dystans; 14/02/2013 at 11:26 AM.
)
Hello. I would like to introduce you to tutorial. So... let's get started.
The first thing we need to do is download the Visual Studio. I based on the 2010 Express version, so some options may be worded differently than the older / newer versions. But to the point - download this file (this is Visual Studio 2010 Express, the free Express version), unless I have already installed it then move on. After downloading the file, weighting "only" 694 Megabytes, open it in Daemon Tools or any other program that supports CD images, then select the file, open it and go to install, which I will not describe because it takes more time than the actual writing of this guide.
WARNING! TO "CHANGE" VISUAL YOU MUST TURN OFF INTELLISENSE FOR VISUAL C++ / STUDIO!
And now to the point - we run our newly downloaded / installed a long time ago IDE and select from the menu "File", "New":
Then select the "Makefile project". In this way we will be able to interfere with the command line, and it's so we can start the "coding in Visual":
Okay, now just fill name of your project, example "Pawn in VS 2010" and start making for real. Once you enter the name of the project, window appears "Makefile Project Wizard" - "your project name" (for me - "Pawn in VS 2010"). From what we can see in the picture below, by default it is set to create a file .exe and configurations "Debug" and "Release". Everything would be fine but for the unfortunate file type .exe (and of course the command line, but more on that I wrote later). In addition, we see a bold note with information, that the wizard will not add any files to the project after taking:
Now click on "Next>" and see command line. All good, but what to write in these fields that we see? Now enter the following data:
"Build Command Line":
Note and it's very important! I've installed system on disk E, so that the path looks like this! But you have to change it on your own! In the case of "E:\Users\Longhorn\Desktop\SA-MP Server\pawno\pawncc.exe" you have to write your own path to the compiler pawncc.exe! And most importantly - where there is a quotation mark, it has to be there, where it's not - there can't be!
"Include Search Path":
As above, this is only my path to the pawno\include. You have to turn it on your own.
"Output (for debugging):"
The whole should look at the with preserved order of the tracks:
Well, now it's time to press once again the button "Next>" and go to the settings in the "Release". Here you can also set the same options as I wrote above, or click on "Same as debug configuration" (as in the picture above):
And that's the end ... but only the configuration, now simply press "Finish" and after a few seconds you are ready. Empty Makefile project looking that:
Now we need to add a soruce file - .pwn to see if it actually works. But first, let's remove the "Header Files", "Resource Files", "Source Files" and "readme.txt". After this action is only "External Dependencies", although it's not used. Now click right mouse button of the name a walkthrough (in my case it is Pawn in VS 2010):
Here we put name of the new filter, which in reality is create a new folder. We can set any name (I have a Pawn_in_VS_2010). Now again click right click button, but this time of the name a newly created folder/filter. Then select "Add" - "New item" if you want to add a new file to your project Makefile, or "Add" - "Existing item" if you want to add an existing file to the project. Another option maybe I will describe below, but it is only on selected existing file and add it to the walkthrough. I will describe for it (at least try to) add new file .pwn to the project.
In the case of the first option, it looks like that:
Then click on the "C++ File" in the "Name:", enter the name of file that needs to be saved with the extension .pwn . Here you can see in the picture below how it looks:
Well, in the "Pawn_in_VS_2010" we have a file "Pawn_in_VS_2010.pwn", but now we can start to write something other in the file (maybe something like #include <a_samp>, etc.), the syntax will be as in the plain text file. To "fix" / modify, click now on the Tools, then the Options (in such a way as here), what effect is result shown below:
Now click left mouse button on the "Text Editor", then select the "File Extension" and the "Extension:", type .inc, click on the text below the Editor: and select Microsoft Visual C++. In the same way we do in the other two extensions, the .p and .pwn. Note that even if you type in Extension: extension with a dot, it will disappear, so we might as well write extensions without dots, or simply inc, p and pwn:
Now click on the "C/C++". If you want to know exactly where the lines are currently in the edited file, select the "Line numbers":
Then you go to the tab Advanced, you are looking for IntelliSense. Now, next to "Disable IntelliSense", change the entry from "False" to "True", which disable the IntelliSense. All good, but why to disable IntelliSense, since it "tells" the visual how to do different things? Well, after that, in the case of language Pawn, the entire file will be highlighted in "red", and IntelliSense will see errors where they do not exist:
Now press Ok to close opened file .pwn (once it has been opened) and re-open it. After entering this test "script":
you should see the same syntax highlighting as in C++, also by pressing the F5 key, Visual should display this information:
One additional note:
Thank you for your attention ******, the "omit" of warning 217 was removed.
The first thing we need to do is download the Visual Studio. I based on the 2010 Express version, so some options may be worded differently than the older / newer versions. But to the point - download this file (this is Visual Studio 2010 Express, the free Express version), unless I have already installed it then move on. After downloading the file, weighting "only" 694 Megabytes, open it in Daemon Tools or any other program that supports CD images, then select the file, open it and go to install, which I will not describe because it takes more time than the actual writing of this guide.
WARNING! TO "CHANGE" VISUAL YOU MUST TURN OFF INTELLISENSE FOR VISUAL C++ / STUDIO!
And now to the point - we run our newly downloaded / installed a long time ago IDE and select from the menu "File", "New":
Then select the "Makefile project". In this way we will be able to interfere with the command line, and it's so we can start the "coding in Visual":
Okay, now just fill name of your project, example "Pawn in VS 2010" and start making for real. Once you enter the name of the project, window appears "Makefile Project Wizard" - "your project name" (for me - "Pawn in VS 2010"). From what we can see in the picture below, by default it is set to create a file .exe and configurations "Debug" and "Release". Everything would be fine but for the unfortunate file type .exe (and of course the command line, but more on that I wrote later). In addition, we see a bold note with information, that the wizard will not add any files to the project after taking:
Now click on "Next>" and see command line. All good, but what to write in these fields that we see? Now enter the following data:
"Build Command Line":
Code:
"E:\Users\Longhorn\Desktop\SA-MP Server\pawno\pawncc.exe" "$(LocalDebuggerWorkingDirectory)\$(TargetName).pwn "-O1 -r -; -(
"Include Search Path":
Code:
D:\Users\Longhorn\Desktop\SA-MP Server\pawno\include
"Output (for debugging):"
Code:
$(TargetName).amx
Well, now it's time to press once again the button "Next>" and go to the settings in the "Release". Here you can also set the same options as I wrote above, or click on "Same as debug configuration" (as in the picture above):
And that's the end ... but only the configuration, now simply press "Finish" and after a few seconds you are ready. Empty Makefile project looking that:
Now we need to add a soruce file - .pwn to see if it actually works. But first, let's remove the "Header Files", "Resource Files", "Source Files" and "readme.txt". After this action is only "External Dependencies", although it's not used. Now click right mouse button of the name a walkthrough (in my case it is Pawn in VS 2010):
Here we put name of the new filter, which in reality is create a new folder. We can set any name (I have a Pawn_in_VS_2010). Now again click right click button, but this time of the name a newly created folder/filter. Then select "Add" - "New item" if you want to add a new file to your project Makefile, or "Add" - "Existing item" if you want to add an existing file to the project. Another option maybe I will describe below, but it is only on selected existing file and add it to the walkthrough. I will describe for it (at least try to) add new file .pwn to the project.
In the case of the first option, it looks like that:
Then click on the "C++ File" in the "Name:", enter the name of file that needs to be saved with the extension .pwn . Here you can see in the picture below how it looks:
Well, in the "Pawn_in_VS_2010" we have a file "Pawn_in_VS_2010.pwn", but now we can start to write something other in the file (maybe something like #include <a_samp>, etc.), the syntax will be as in the plain text file. To "fix" / modify, click now on the Tools, then the Options (in such a way as here), what effect is result shown below:
Now click left mouse button on the "Text Editor", then select the "File Extension" and the "Extension:", type .inc, click on the text below the Editor: and select Microsoft Visual C++. In the same way we do in the other two extensions, the .p and .pwn. Note that even if you type in Extension: extension with a dot, it will disappear, so we might as well write extensions without dots, or simply inc, p and pwn:
Now click on the "C/C++". If you want to know exactly where the lines are currently in the edited file, select the "Line numbers":
Then you go to the tab Advanced, you are looking for IntelliSense. Now, next to "Disable IntelliSense", change the entry from "False" to "True", which disable the IntelliSense. All good, but why to disable IntelliSense, since it "tells" the visual how to do different things? Well, after that, in the case of language Pawn, the entire file will be highlighted in "red", and IntelliSense will see errors where they do not exist:
Now press Ok to close opened file .pwn (once it has been opened) and re-open it. After entering this test "script":
pawn Code:
#include <a_samp>
#define TEST main(){for(new i; i < 5; i++){printf("I to: %d", i);}}
TEST
Code:
1>------ Build started: Project: Pawn_in_VS_2010, Configuration: Debug Win32 ------ 1>Build started 2012-11-03 19:50:52. 1>Build: 1> Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1> 1> 1>Build succeeded. 1> 1>Time Elapsed 00:00:00.12 ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Okay, now it's time to the final note / warning: If you still do not want the file to compile and crashes some tragic errors from space, remove any space, what is the name of the project or use a underscore instead. At 90% it's the fault space that crashes Visual aforementioned errors!
I think I explained everything that was needed to explain in this tutorial and I hope that just a few people will benefit from this "option". I would to answer of any questions in this topic, as well as problems with the command line, and other questions. Cheers.One additional note:
Thank you for your attention ******, the "omit" of warning 217 was removed.