Search code examples
c++cross-platformvisual-studio-2017dynamic-library

VS2017 doesn't copy Additional Include Directories to remote env (linux) causing compilation error


I'm playing with Visual-Studio 2017 c++ cross platform projects (linux). I was able to compile and run a single executable project.

Now I've created two c++ projects. One is a static library, the other is a dynamic library. The dynamic library uses a class from the static library, so I have an #include statement for the corresponding header file that contains the class definition. Compilation fails saying the header file is not found. I added the include directory to Additional Include Directories in the project properties (which usually works with windows vc++ projects). However, it looks like the header file is not copied to the remote linux env (WSL).

I don't want to add the include file to the dynamic library project because there is a reason why Additional Include Directories were invented.

Is there a way to configure the build to copy Additional Include Directories to the remote env?


Solution

  • Files referenced thru Additional Include Directories are expected to be on the Linux remote already, VCLinux doesn't copy them for you. And, to be honest, you wouldn't want it to because additional includes are often third-party packages.

    But if you've built the static library then it's source, including headers, will be present on the Linux remote. Specify the paths to the static library headers and library on the Linux system thru the project settings.