c++visual-studioninjagn

Call Ninja.exe exited with code1


I am trying to create an application in which I am using gn. I tried creating the .exe file with the following command.

gn gen out --ide=vs
ninja -C out

Then, I opened the generated solution file and tried building it, but I am getting an error which says MSB3073 The command "call ninja.exe -C path\to\sln\file main" exited with code 1. main path\to\sln\file

I am confused why this error is coming. I have searched over many places for this but didn't get any desired results.


Solution

  • My Solution revolves around GN with ninja for Cross-platform development.

    We use the following commands for creating build files:-

    gn clean out //Cleans the build files
    gn gen out 
    gn gen --ide=vs out  //Creates .sln file for the build files
    ninja -C out  //Build Files
    

    But to build using visual studio, by default, the architecture is set to x32 while hinders ninja to build using visual studio.

    So, we need to modify the architecture to x64 for ninja to build using visual studio which can be done using the following:-

    SET GYP_DEFINES=target_arch=x64
    

    Further reference can be taken from this link, if you are building on chromium:-

    Chromium ninja build