C#WPF和C ++ / CLI和C ++在C ++ / CLI中添加外部库错误

问题描述 投票:1回答:1

我正在VS 2017中设置[C#WPF]和[C ++ / CLI]和[带有外部库的C ++代码]解决方案。

我有一个包含3个项目的VS解决方案:test_app(c ++),Wrapper(C ++ / CLI)和Sandbox(C#WPF)。

解决方案是正确的,并且无需添加库。

我使用conan作为程序包管理器(添加了VS conan扩展名,并将conanfile.txt包含到我的test_app项目中。

conanfile.txt:

 [requires]
 boost/1.69.0@conan/stable
 websocketpp/0.8.1@bincrafters/stable
 [generators]
 visual_studio

c ++ test_app生成无错误:

1>Done building project "test_2_aaa.vcxproj".
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

但是如果我添加到我的test_app / Entity.h标头中并编译soultion,我的C ++ / CLI包装器中就会出错(柯南安装deps和test_app正常重建):

2>------ Rebuild All started: Project: Wrapper, Configuration: Debug Win32 ------
2>stdafx.cpp
2>AssemblyInfo.cpp
2>Entity.cpp
2>c:\users\taipoxin\source\repos\test_2_aaa\test_2_aaa\entity.h(3): fatal error C1083: Cannot open include file: 'websocketpp/client.hpp': No such file or directory
2>Generating Code...
2>Done building project "Wrapper.vcxproj" -- FAILED.
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

也许在配置项目或链接时遇到问题,但我无法理解是什么不好的。我在Wrapper中使用test_app,在Wrapper / Entity.h]中使用标头#include "../test_2_aaa/Core.h"

我的test_app配置为静态库(.lib)

,而包装器配置为动态库(.dll)

test_app已在包装程序的项目依赖项中检查。

具有整体结构的屏幕:solution

我的test_app主文件:

https://gist.github.com/taipoxin/0a2e908c7e7c2ca621361a3a656830a2

我的包装器主文件:

https://gist.github.com/taipoxin/6771b9372af6c00f7eee3896638b39d8

如果还有其他问题,可以问我。

谢谢。

UPD:我也尝试将conanfile添加到Wrapper并在那里安装deps,但是尝试时会出现许多错误。

我正在VS 2017中设置[C#WPF]和[C ++ / CLI]和[C ++代码和外部库]解决方案。我有一个VS解决方案,其中包含3个项目:test_app(c ++),Wrapper(C ++ / CLI)和沙箱(C#WPF)。 ...

c++ visual-studio c++-cli conan
1个回答
0
投票

我通过修改WPF-C ++ / CLI层,使用WPF C ++ / CLI和C ++库制作了另一个VS解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.