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

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

我有一个VS解决方案,其中包含3个项目: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标头中并进行编译,则我的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 / Entity.h中使用标头#include "../test_2_aaa/Core.h"在Wrapper中使用test_app

我的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,但是尝试时会出现许多错误。

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

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

现在,它已在GNU GPL v3下测试并发布到我的公共github repository

享受:)

本文链接:https://www.f2er.com/3124902.html

大家都在问