Building a static library from the command line
-
I have a project that I had previously gotten working in the form of two Visual Studio C++ solutions, one of which produces a static library, and the other of which is a front end that uses that library. I would like to replace the library solution with a folder that holds nothing but the source, to be compiled on the command line. The library source takes the form of three headers, game.h, pieces.h, and back_end.h, each with a matching .cpp file. back_end.h contains the declarations for all the functions called by the front end, and includes the other two headers. The procedure I'm currently using to build the library is
cl /c /std:c++17 game.cpp
cl /c /std:c++17 pieces.cpp
cl /c /std:c++17 back_end.cpp
lib game.obj pieces.obj back_end.objThis runs without errors, but when I try to compile the front end, which includes back_end.h, I get unresolved external symbol errors for precisely the functions that are called in back_end.cpp but declared and defined in one of the other .h/.cpp pairs. My best guess is that this means I need to somehow account for linkage in a way I don't currently when I build the library. Does that seem right? What might it be?