03-09-2010, 04:36 AM
Sometimes it is nice to compile software yourself, just for safety's sake.
I noticed there were a few people that couldn't get minerCPP to compile, so I made this quick (image heavy) tutorial to guide you through. While the project used in the tutorial is specific to minerCPP, the basic process is essentially the same for other software, even those written in different languages.
ALL THE IMAGES ARE CUT OFF. TO VIEW THE ENTIRE IMAGE, RIGHT CLICK AND HIT "VIEW IMAGE". I WAS TOO LAZY TO SHRINK THESE.
To start, I will be using Microsoft Visual Studio Professional Edition. You can use the Microsoft Visual C++ Express Edition if you like, you just wont have the bells and whistles I do (none of them are actually used here). You will need to first open the program (no shit right?):
![[Image: Step1.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step1.jpg)
Relatively simple stuff so far. Next we need a project file. The project is Visual Studio's way of keeping track of where all your code is placed. It also determines some basic build rules, and the type of program that you will make.
![[Image: Step2.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step2.jpg)
Now we need to determine what kind of project we want. minerCPP in specific is considered a "Console Application" and needs to be created as such. In the project window, select the "Win32" project type, and then the "Win32 Console Application" template. Give it a name, and the default directory is probably fine.
![[Image: Step3.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step3.jpg)
On the next screen, click "Next".
![[Image: Step4.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step4.jpg)
You will notice some basic application settings. Ensure that "Console Application" is selected and check off "Empty Project" as in the picture. Now hit finish.
![[Image: Step5.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step5.jpg)
On the left is a "Solution Explorer". This is a visualization of your project. If you do not have a Solution Explorer, click View -> Solution Explorer. Once your explorer is sorted out, right click any folder (I use source because I want too) and click Add -> Existing Item.
![[Image: Step6.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step6.jpg)
Now locate the folder that the source files that you downloaded are contained. In my picture you see green check marks on them, this is from SVN. You may or may not have these, they are not important for this. Select all your source files (everything in the trunk folder) and click "Add".
![[Image: Step7.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step7.jpg)
Now all the source files will appear in your Solution Explorer. You can double click and view these if you want, but modification should not be needed.
![[Image: Step8.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step8.jpg)
Now we need to compile the project so we can run it. Click Build -> Rebuild Solution. If "Rebuild Solution" is not an option, just use "Build".
![[Image: Step9.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step9.jpg)
Ok so now it is compiling. You will get a load of warnings, all of which can be ignored for now. At the very bottom however, there is an error about zlib. Let's examine this. ZLIB is a compression library. A library contains functions and code that your programs can use, if you tell them too do so. minerCPP uses ZLIB, and so we need to make sure the project knows that.
![[Image: Step10.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step10.jpg)
Go and download the ZLIB binaries. Unzip the file, and READ THE INSTRUCTIONS. I can not stress this enough, read every read-me file that is provided. In the read-me are instructions on how to include ZLIB. Follow the three steps. For simplicity (and because I'm a bit lazy) I will only show the last one. Right click one of the folders, and click Add -> Existing Item and find the zlib.lib that you downloaded and add that file.
![[Image: Step11.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step11.jpg)
You should get a pop-up about a "Custom Build Rule". Click "No", if you didn't get a pop-up, then you are in the clear.
![[Image: Step12.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step12.jpg)
Now you need to build your project again, the same way we did up above.
![[Image: Step13.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step13.jpg)
This time to build succeeded, and you should find an executable in "<project location>/Debug/" but we don't want this one. Debug is used to find and fix bugs. These executables are very large, and contain extra code to help Visual Studio detect bugs. We want a "Release" file, one that does not have the debug information contained within it. Look up top and you should see a dropdown box that says "Debug" which is to the left of a play button. Change it to say "Release", and rebuild.
![[Image: Step14.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step14.jpg)
That should do it for compiling your own server. These same steps will work as a general method for other software and coding languages as well. What will change is the "Project Type" that we selected earlier based on the language and type of software. Some languages use non-Microsoft compilers, but even these generally follow the same basic steps. Create a project, select type, add your source, compile, add missing libraries, compile again.
If you have questions on specifics, or methods, just drop them here. If you have questions on ZLIB and you did not follow ZLIB's directions, then don't ask until you did what they require first.
I noticed there were a few people that couldn't get minerCPP to compile, so I made this quick (image heavy) tutorial to guide you through. While the project used in the tutorial is specific to minerCPP, the basic process is essentially the same for other software, even those written in different languages.
ALL THE IMAGES ARE CUT OFF. TO VIEW THE ENTIRE IMAGE, RIGHT CLICK AND HIT "VIEW IMAGE". I WAS TOO LAZY TO SHRINK THESE.
To start, I will be using Microsoft Visual Studio Professional Edition. You can use the Microsoft Visual C++ Express Edition if you like, you just wont have the bells and whistles I do (none of them are actually used here). You will need to first open the program (no shit right?):
![[Image: Step1.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step1.jpg)
Relatively simple stuff so far. Next we need a project file. The project is Visual Studio's way of keeping track of where all your code is placed. It also determines some basic build rules, and the type of program that you will make.
![[Image: Step2.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step2.jpg)
Now we need to determine what kind of project we want. minerCPP in specific is considered a "Console Application" and needs to be created as such. In the project window, select the "Win32" project type, and then the "Win32 Console Application" template. Give it a name, and the default directory is probably fine.
![[Image: Step3.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step3.jpg)
On the next screen, click "Next".
![[Image: Step4.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step4.jpg)
You will notice some basic application settings. Ensure that "Console Application" is selected and check off "Empty Project" as in the picture. Now hit finish.
![[Image: Step5.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step5.jpg)
On the left is a "Solution Explorer". This is a visualization of your project. If you do not have a Solution Explorer, click View -> Solution Explorer. Once your explorer is sorted out, right click any folder (I use source because I want too) and click Add -> Existing Item.
![[Image: Step6.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step6.jpg)
Now locate the folder that the source files that you downloaded are contained. In my picture you see green check marks on them, this is from SVN. You may or may not have these, they are not important for this. Select all your source files (everything in the trunk folder) and click "Add".
![[Image: Step7.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step7.jpg)
Now all the source files will appear in your Solution Explorer. You can double click and view these if you want, but modification should not be needed.
![[Image: Step8.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step8.jpg)
Now we need to compile the project so we can run it. Click Build -> Rebuild Solution. If "Rebuild Solution" is not an option, just use "Build".
![[Image: Step9.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step9.jpg)
Ok so now it is compiling. You will get a load of warnings, all of which can be ignored for now. At the very bottom however, there is an error about zlib. Let's examine this. ZLIB is a compression library. A library contains functions and code that your programs can use, if you tell them too do so. minerCPP uses ZLIB, and so we need to make sure the project knows that.
![[Image: Step10.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step10.jpg)
Go and download the ZLIB binaries. Unzip the file, and READ THE INSTRUCTIONS. I can not stress this enough, read every read-me file that is provided. In the read-me are instructions on how to include ZLIB. Follow the three steps. For simplicity (and because I'm a bit lazy) I will only show the last one. Right click one of the folders, and click Add -> Existing Item and find the zlib.lib that you downloaded and add that file.
![[Image: Step11.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step11.jpg)
You should get a pop-up about a "Custom Build Rule". Click "No", if you didn't get a pop-up, then you are in the clear.
![[Image: Step12.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step12.jpg)
Now you need to build your project again, the same way we did up above.
![[Image: Step13.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step13.jpg)
This time to build succeeded, and you should find an executable in "<project location>/Debug/" but we don't want this one. Debug is used to find and fix bugs. These executables are very large, and contain extra code to help Visual Studio detect bugs. We want a "Release" file, one that does not have the debug information contained within it. Look up top and you should see a dropdown box that says "Debug" which is to the left of a play button. Change it to say "Release", and rebuild.
![[Image: Step14.jpg]](http://i238.photobucket.com/albums/ff111/biocon8600/Step14.jpg)
That should do it for compiling your own server. These same steps will work as a general method for other software and coding languages as well. What will change is the "Project Type" that we selected earlier based on the language and type of software. Some languages use non-Microsoft compilers, but even these generally follow the same basic steps. Create a project, select type, add your source, compile, add missing libraries, compile again.
If you have questions on specifics, or methods, just drop them here. If you have questions on ZLIB and you did not follow ZLIB's directions, then don't ask until you did what they require first.


