0

I have two projects in my solution: 1. Project1, containing camera code which captures image frames 2. Project2, which takes input image and does processing on it. I would like to share/provide the image generated in project1 to the project2. I am trying to use Project references to share data between projects.

I created a class(with namespace) containing the required data members(to be shared) and member functions(populating the data members) in Project1. I am not able to use this class in Project2 despite adding Project Reference in Project2.

Project1:
namespace TheImagingSource
{
    class Images {
    public: 
        UINT8 input_image1[IMAGE_SIZE];
        UINT8 input_image2[IMAGE_SIZE];

        void upload_image(Mat);
    } TIS;

    void Images::upload_image(Mat m)
    {
        memcpy(input_image1, m.data, IMAGE_SIZE);
        memcpy(input_image2, m.data, IMAGE_SIZE);
    }
}

The 'using Project1' statement in Project2 gives error: identifier 'Project1' is undefined.

  • I don't really understand what you are asking. What are the projects? Are they both applications? To share data between seperate processes you need other means such as pipes or sockets. Or to just re-use existing code put it in a static (.lib) or dynamic (.dll) library project and reference that. – Fire Lancer Apr 10 '19 at 12:30
  • 1
    Also you will need to use *header files*, it doesn't look like you are in that code, so check out some learning resources on those. Then you use `#include "class_in_other_project.h"` to access it from a static or dynamic library, not sure what you are getting at by "using Project1". – Fire Lancer Apr 10 '19 at 12:32
  • @FireLancer yes, both projects are individual applications. And I want to share an image generated by Project1 with the Project2 so that it can process and then send back processed image to Project1. Right now, I am not combining both projects because in future there may be more projects of type Project2 using image from Project1. I will see if the DLL method works for me. I got the idea of Project References and the `using` statement from this [link](https://stackoverflow.com/questions/3554658/how-to-use-a-class-from-one-c-sharp-project-with-another-c-sharp-project) – Garv Sharma Apr 11 '19 at 04:01
  • So the user will run both applications (exe) at the same time, with their own seperate windows etc., on the same computer? Or you have just one exe, "Project2"? – Fire Lancer Apr 11 '19 at 07:51
  • Yes, since they are in the same solutions, they are launched simultaneously and then start sharing data. – Garv Sharma Apr 12 '19 at 06:54

0 Answers0