c - reference other projects in visual studio for win32 projects -


I am working with the Win32 API and my preferred language is C and C ++ .

Assume that I have a project A which is present in the S solution in Visual Studio

I S

A ... because I can use those utility functions from the project B source code level, against the project's DLL There are some math related functions in Project B, and I want to call a function from project A or Project B, which includes data structures I and I want to use them in Project A

How to get it ... Thanks in advance

If you do not want Project B to do DLL , Then it should be a static library. This project is already an EXE, then you have to add a third project: Project C - A static library project that has shared source files between A and B. Projects A and B can either reference or list it as a project dependency.


OK if you create a solution in Devstudio with projects, then the default layout on disk will be something like this - a project 3 is created as a static library project:

  c: \ Projects \ SolutionDir \ Project1 \ Project2 \ Project3  

Source (.ccp) and header files (.h) to project 3 for common structs and functions Take in

Projects include A and B, Project Settings> Compiler> Extra and add an entry that says

  $ (SolutionDir)  

Now, in Projects 1 and 2, you can refer to header files from Project 3:

  # "Project 3 / Common Headquarters" or "Include" project 1 / Shared FunctionsClose. " Right-click on #include "Project 2 / Shadstroke Defs" code> 

Project 1 (and then Project 2) and select "Project Dependency ..." and tick on Project 3.


Comments