c++ - Visual Studio 2005 Linker problem -
I'm new to most of the Visual Studio, so I'm sorry that this is a basic problem. I have a solution in which a number of projects including I project a set of pre-existing files to me that I use coded functionality in the new class in a new class was added to Project B Project A. Project A has been created first, and the .lib file is generated, and that The lib file is added to Project B. However, when I go to create a .lib file, a link error for project BI gets, refers to the new functionality in Project A that I had added. The resulting from Project A 'Use Dnpbin' command with the .lib file, I notice that the more I that functions like I did not have it, those created went .obj file after compiling a new class of Project A. The symbols are included. Any ideas why those symbols are not present in the project's A.Lib file?
I think that these two DLLs projects on Windows or they __ declspec ( Dllexport)
need to export symbols by decorating with, or you need to export symbols which indicate by using an .def file.
then when you want to export all members of a class, you write: and Here's something. Although it can be difficult to maintain, and in C ++ you need to list the decorated name of each symbol, which can be a pain.
#ifdef PROJECT_A_EXPORTS #define PROJECT_A_API __declspec (dllexport) #else #define PROJECT_A_API __declspec (dllimport) # code> __ declspec
, it is common as the header is used by some endif from
Class PROJECT_A_API MyClass {// ...};
defined PROJECT_A_EXPORTS
when Project A, but B project like this compilation, you can share the same MyClass.h header files between the two projects. When compiling Project A, you will export the symbols, and while compiling Project B, you import the symbols.
Comments
Post a Comment