Link to other projects in visual studio for win32 projects

I work with win32 API and my choice language is pure C and not C ++ .

Suppose I have a project A that is present in solution S in visual studio

I want to add another project B (which has some common utility functions) to S

Now I want to reference Project B in Project A ... so that I can use these utility functions from Project B source code level. I do not want it to be used against project B dll

Suppose project B contains some math related functions, and I want to call functions from project A, and project B contains data structures, and I want to use them in Project A

How to achieve this ... thanks in advance

+3
source share
1 answer

If you do not want project B to be a DLL, it must be a static library. Project B is already an EXE, then you need to add a third project: Project C is a static library project containing source files shared between A and B. Projects A and B can reference it or list it as a dependency project.


Ok. Devstudio , - : 3 :

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

(.cpp) (.h) Project 3.

A B " " > "" > "" ,

$(SolutionDir)

1 2 Project3 :

#include "Project3/commonheader.h"
// or
#include "Project1/sharedFunctionDecls.h"
#include "Project2/sharedStructDefs.h"

Project1 ( Project 2) "Project Dependencies..." Project 3.

+6

Source: https://habr.com/ru/post/1745746/


All Articles