Re: More projects in a C++ solution: how to link them together?
From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 12/16/04
- Previous message: Igor Tandetnik: "Re: More projects in a C++ solution: how to link them together?"
- In reply to: Agoston Bejo: "More projects in a C++ solution: how to link them together?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 16 Dec 2004 15:16:53 -0500
Agoston Bejo wrote:
> I have two projects, one depending on another. In the first a global
> variable is defined:
> x.hpp:
> extern int x;
> x.cpp:
> int x = 5;
>
> When in the second project I try to use this global variable, I get a linker
> error:
> [...].obj : error LNK2001: unresolved external symbol
>
> How do I tell the linker to also use the object files from the first
> project? Or is it such that global variables are only "project-global" but
> cannot be made "solution-global"?
Global variables are "target-global". I.e. their 'globality' is limited
by the bounds of the result of linking.
I presume at least one of your projects is a DLL (the one with the global
object 'x'). You need to add the .lib file that is built as a result of
linking that project to the other project's library list.
V
- Previous message: Igor Tandetnik: "Re: More projects in a C++ solution: how to link them together?"
- In reply to: Agoston Bejo: "More projects in a C++ solution: how to link them together?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|