C++ MSVC through the Command Prompt

Ello there. I dislike using Visual Studio, and I was wondering if anyone knew how to compile Panda3D through the developer command prompt. Thanks.

I do this using a bat file.

main.cpp

#include "pandaFramework.h"
#include "pandaSystem.h"

int main(int argc, char *argv[]) {
  // Open a new window framework
  PandaFramework framework;
  framework.open_framework(argc, argv);

  // Set the window title and open the window
  framework.set_window_title("My Panda3D Window");
  WindowFramework *window = framework.open_window();

  // Do the main loop, equal to run() in python
  framework.main_loop();
  framework.close_framework();
  return (0);
}

bat file

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" x86_amd64

cl /Ot /MD /EHsc /I  D:\Panda3D-1.10.9-x64\include main.cpp /link /libpath:D:\Panda3D-1.10.9-x64\lib /out:D:\MyGame\game.exe ^

libp3framework.lib ^
libpanda.lib ^
libpandaexpress.lib ^
libp3dtool.lib ^
libp3dtoolconfig.lib

pause
1 Like

I’m getting an error that the libraries can’t be opened.

I can’t help you without more information.

  1. Installation directory of the panda.
  2. Console output with errors.

I also added a sample code for which this command works.

My apologies, I actually forgot to change the directory from D to C. Thanks for the help!