How to compile AVRA with MS Visual Studio 2019

October 6, 2020 ยท View on GitHub

How to compile AVRA https://github.com/Ro5bert/avra with MS Visual Studio 2019

New Project > Console Application > C++ (create it empty without any files)

Import all .c and .h files from AVRA src folder

In file.c, you will need to change line #include <unistd.h> into: #include "unistd.h"

Add unistd.h to the project from https://stackoverflow.com/questions/341817/is-there-a-replacement-for-unistd-h-for-windows-visual-c#826027

In unistd.h change line #include <getopt.h> to : #include "getopt.h"

Add getopt.h to the project from https://gist.github.com/ashelly/7776712

To suppress C4996 errors: Right click on your project, go to properties Configuration Properties > C/C++ > Preprocessor

Add these (separated by semicolons) to Preprocessor Definitions: _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;

see here for details: https://stackoverflow.com/questions/16883037/remove-secure-warnings-crt-secure-no-warnings-from-projects-by-default-in-vis#20753468

Compile!