Visual C ++ for Linux:将内容文件复制到构建目录? [英] Visual C++ for Linux: copy content files to build directory?

查看:139
本文介绍了Visual C ++ for Linux:将内容文件复制到构建目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2017中有一个用于Linux项目的Visual C ++,我正在构建运行Raspbian的Raspberry Pi。该项目由单个源文件(main.c)和图像(test.jpg)组成。在构建项目时,我希望图像文件也可以部署到
到pi,以便main.c中的代码可以在本地执行某些操作。但是,我无法弄清楚如何执行此操作


图像文件的Content属性设置为True,如Project中包含的那样。在项目属性中,在"复制源"下,"要复制的源"设置为"@(SourcesToCopyRemotely)"。和复制源设置为"是"。但是,当我构建时,
只将main.c复制到Pi,编译器输出只是一个.out文件。我希望在那里看到test.jpg,但是唉。


本文 提到@(SourcesToCopyRemotely)默认为项目中的所有文件。但是,当我评估
@的值时(SourcesToCopyRemotely,它只评估为"main.c"。


如何确保项目中的内容文件也结束在构建目录中,以及.out文件?最好不必在构建后步骤中手动输入每个文件名。

解决方案

Hi BasRP,


感谢您在此发布。


>> 我希望也部署图片文件到pi,所以main.c中的代码可以在本地做一些事情。但是,我无法弄清楚如何做到这一点


在我看来,Copy Sources属性中的源代表所有源文件,如cpp,c文件,而不是像.jpg文件这样的资源文件。


所以我建议你使用像
CopyFile函数
手动复制图像文件到本地文件夹。


希望这可以帮助你。


最好的问候,


Sera Yu


I have a Visual C++ for Linux project in VS2017 that I'm building on a Raspberry Pi running Raspbian. This project consists of a single source file (main.c) and an image (test.jpg). When building the project, I want the image file to also be deployed to the pi, so that the code in main.c can do something with it locally. However, I can't figure out how to do this

The image file's Content property is set to True, as is Included in Project. In the project properties, under Copy Sources, Sources to Copy is set to "@(SourcesToCopyRemotely)" and Copy Sources is set to "Yes". However, when I build, only main.c is copied to the Pi, and the compiler output is just a single .out file. I hoped to also see test.jpg there, but alas.

This article mentions that @(SourcesToCopyRemotely) defaults to all files in the project. However, when I evaluate the value of @(SourcesToCopyRemotely, it evaluates to just "main.c".

How do I make sure content files in my projects also end up in the build directory, along with the .out file? Preferably without having to manually enter each filename in a post-build step.

解决方案

Hi BasRP,

thanks for posting here.

>> I want the image file to also be deployed to the pi, so that the code in main.c can do something with it locally. However, I can't figure out how to do this

In my opinion, the sources in the Copy Sources property mean all the source files such as cpp, c files, not resource files like .jpg files.

So I suggest you use like CopyFile function to manually copy the image files into the local folder.

Hope this could be help of you.

Best Regards,

Sera Yu


这篇关于Visual C ++ for Linux:将内容文件复制到构建目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆