Collin
Collin

Reputation: 83

Set up Visual Studio to enable Access to other projects and how to make projects able to reference each other (C++)

Very newb question on this, but most things I read are overly complex or hop between 10 things without saying anything.

I came from Java, and want to learn C++. I have made a small project (5 classes + main) that would be useful in many future projects I want to attempt.

I am trying to set up Visual Studio such that I can call the class set of this project similar to how libraries are called, while referencing other libraries as needed. I managed to add this project to the intellisense (I think that is the right word) on a new project by

right click project >properties > Config Properties > C/C++ > General > Additional Include Directories.

Running the new project fails though due to "unresolved external symbol" errors.

Ideally, I would be able to call the classes and functions of this project like other libraries, and be able to ignore structure, and have it so I can expand this easily, such that I could have a personal Math folder, Map folder, and others be accessible with just #includes and then running it.

Visual Studio Version Info: Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.1.2

I don't even know if it is possible, but I think it is, as it would be hellish to build large games or programs without the ability to cross reference other stuff easily.

Upvotes: 1

Views: 436

Answers (1)

Yujian Yao - MSFT
Yujian Yao - MSFT

Reputation: 954

If you need to create and use static library, you need to read this issue.

If you need to use dynamic library, you need to read this issue.

Upvotes: 1

Related Questions