Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Building a static library from the command line

Building a static library from the command line

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpvisual-studiogame-devquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alexander Kindel
    wrote on last edited by
    #1

    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.obj

    This 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?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups