Nickolas
Nickolas

Reputation: 790

How to use files in another Project in Visual Studio 2005?

I have a solution with two project in Visual Studio 2005. I want to use Project2's files in Project1. I included the head file and compiled it successfully. There comes the error LNK2019 when linking. However it runs well in project2 using the same file.

It is not about the obj path, cause I have tried move them to the same folder. I have searched a lot on msdn if Build Event can help. But I have no answer. http://msdn.microsoft.com/en-us/library/e85wte0k(v=vs.80).aspx

Thanks in advance.

Upvotes: 1

Views: 551

Answers (1)

Armen Tsirunyan
Armen Tsirunyan

Reputation: 132984

If Project2 is a library, then all you have to do is link Project1 against Project2 by right-clicking Project1 -> Project dependencies and select Project2. If Project2 is not a library, then you must include the sources to Project1 as well, that is by clicking Project1->Add existing Items, and selecting the relevant cpp files from Project2. Hth

Upvotes: 1

Related Questions