Static Library C++ Unresolved External Symbol

a_unique_name 401 Reputation points
2024-09-20T06:14:09.39+00:00

Hello Folks:

Developing on Win 10 Pro, VS Community 2022 updated today, all C++.

This feels like I must be doing something stupid. Perhaps I forgot to do something.

I like to use static libraries.

I created a new library called common_diagnostic to give all of my diagnostic output a common look and feel.

I've started with the library having two files, header and source, that should define a const char * for use by other modules.

These files are just minimal to get a build to work:

#pragma once

#include "pch.h"

Building Application

I altered common_diagnostic.cpp to force it to be compiled with Build > Build Solution. It seems to compile without error. DEFAULT_DIAGNOSTIC_INDENT is defined in that file as a global variable.

Commctrl_diagnostics is a different static library, currently the only module that makes an external referenc to DEFAULT_DIAGNOSTIC_INDENT.

Here is the build report:

1>------ Build started: Project: common_diagnostic, Configuration: Debug Win32 ------

I think I've done what's needed for dependencies:

screenshot_1

screenshot_5

I've noticed the .cpp files in all of the other libraries I've built and used have #include "StdAfx.h". This library uses #include "pch.h".

I have no idea if that bit if information helps.

What did I forget?

Thanks
Larry

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,734 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.