How do I reference one VC++ project from another in the same project?

前端 未结 2 769
清酒与你
清酒与你 2021-01-22 18:07

I am new to Visual Studio. Need your help with the following.

Visual Studio 2005, VC++
1 solution has 2 projects.
Lets call the solution as \'solution\'
Proj

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-22 18:58

    If I remember correctly (haven't used C++ for a while), there were two different kinds of C++ libraries - a static library (a .lib file) and a dynamic library (a .dll file).

    In the case of a static library you had to configure p2 so that it links to p1.lib (in project properties); add p1 to dependancies of p2, so that it is always built first; and then include the .h files from p1 as necessary.

    The .dll file was a bit more tricky - the .h files had to have __declspec(dllimport) and __declspec(dllexport) I think. And there was some more magic. Not sure really. But these are the keywords that might get you up and running.

    Note that this is a MS specific keyword and will not work on other compilers.

提交回复
热议问题