1

I have two projects in the same Visual Studio 2019 solution. My first project creates an exe whereas the second is a dynamic library. I've linked the second project to the first one, so now I can use class, structs, variables and functions that are declared and defined in the second project in the first one. But I can't call functions in the project 2 that are in the project 1. I do not know how can I link my first project to the second.

When I try to access to the project 1 when I'm in the second, linker errors appears

AlienEngineCore.obj : error LNK2019: external symbol "void __cdecl log(char const * const,int,char const *,...)" (?log@@YAXQBDHPBDZZ) unresolved to which reference is made in functi¾n "void __cdecl LogToConsole(void)" (?LogToConsole@@YAXXZ)
Dale K
  • 25,246
  • 15
  • 42
  • 71
  • 3
    You can't have circular references in projects. Whatever shared code both projects need, put it in a third project. – Gert Arnold Dec 01 '19 at 19:47
  • When I have a couple short projects that share a few classes I put those CPP and H files in the solution directory with each project in their own subdirectories. Then include the existing files as needed for each project. Also add the solution directory as an include search directory for the projects that need it. Not a solution to including dlls but it allows for different compile options for the projects and isolates them. – doug Dec 01 '19 at 20:06

0 Answers0