参考静态库项目在Visual Studio
Reference static library project in Visual Studio
TL;DR:如何使一个项目依赖于visual studio中的另一个静态库项目
我想做一个小的c++项目,使用这个库:http://finitetransform.sourceforge.net/
库包含两个项目。NTTW和FRTW,其中FRTW依赖于NTTW。我的项目应该依赖于FRTW。NTTW和FRTW以及相对较小和简单的库,没有任何外部依赖(除了c标准库)
现在我是Visual studio中c++开发的新手,但我已经在谷歌上搜索了好几天,想知道如何设置这个。
这就是我想要的:我想要一个解决方案在visual studio中,我可以建立NTTW, FRTW和他们我自己的游乐场应用程序,在那里我可以玩库。我想从源代码构建这两个库,因为我可能想要编辑它们。
这就是我所拥有的:我已经在Visual Studio中创建了一个具有我想要的结构的解决方案。我已经创建了我自己的项目(一个c++控制台应用程序),一个NTTW项目和一个FRTW项目-两者都创建了一个"静态库"。
由于库是用C编写的,我已经禁用了预编译头文件,以便使它们构建。然后我添加了NTTW作为FRTW的依赖项,FRTW作为我的游乐场项目的依赖项。
工作原理:NTTW build just fine。然而,FRTW没有,因为它不能连接到NTTW。当我试图构建它时,我得到这些错误告诉我它无法从NTTW
找到头文件1>------ Build started: Project: FRTW, Configuration: Debug Win32 ------
1> array_complex.c
1> fourier.c
1> ghosts.c
1> mojette.c
1> noise.c
1> radon.c
1> vector.c
1>u:ctnewprojectfromsourcefrtwghosts.c(26): fatal error C1083: Cannot open include file: 'nttw/image.h': No such file or directory
1>u:ctnewprojectfromsourcefrtwradon.c(27): fatal error C1083: Cannot open include file: 'nttw/image.h': No such file or directory
1>u:ctnewprojectfromsourcefrtwvector.h(29): fatal error C1083: Cannot open include file: 'nttw/array.h': No such file or directory (compiling source file vector.c)
1>u:ctnewprojectfromsourcefrtwfourier.h(25): fatal error C1083: Cannot open include file: 'fftw3.h': No such file or directory (compiling source file fourier.c)
1>u:ctnewprojectfromsourcefrtwarray_complex.h(30): fatal error C1083: Cannot open include file: 'fftw3.h': No such file or directory (compiling source file array_complex.c)
1>u:ctnewprojectfromsourcefrtwnoise.h(45): fatal error C1083: Cannot open include file: 'nttw/global.h': No such file or directory (compiling source file noise.c)
1>u:ctnewprojectfromsourcefrtwmojette.c(29): fatal error C1083: Cannot open include file: 'nttw/prime.h': No such file or directory
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
我不确定从这里该做什么。任何帮助都将不胜感激。由于
查看您的错误,我认为FRTW项目的调试配置设置需要Additional Include Directories
设置更新以包括nttw
目录的父目录。如果打开FRTW项目的属性页,可以在Configuration Properties
-> C/C++
-> General
下找到Additional Include Directories
。
不要忘记Debug和Release有不同的设置,你可以在Debug下更改Release设置和构建。
您可能还需要更新FRTW项目,以包括NTTW通过Configuration Properties
-> Librarian
-> General
生成的静态库文件,并将静态库将输出到Additional Library Directories
的目录和静态库的名称添加到Additional Dependencies
。您可能需要执行类似于Playground应用程序项目的操作来导入FRTW可能生成的静态库。
- Visual Studio 2015:Extern "C" 和 "export" 关键字
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 试图在visual studio上用C++创建一个桌面应用程序
- 如何在MS Visual Studio 2019中运行QT UI
- 如何使用Visual Studio 2017在C++中为参数化对象数组使用唯一指针
- Visual Studio Code - C++ Debugger 無法啟動
- Visual Studio 2019:插入多个C++风格的单行注释
- Visual Studio Code "undefined reference to `WinMain@16'"
- Visual studio代码重构似乎不起作用(例如,重命名符号-f2)
- Visual Studio中的函数声明和函数定义问题
- 如何指定我希望我的LIB链接到的DLL文件?-Visual Studio 2019
- Visual Studio mkl_link_tool.exe链接错误
- Visual Studio(或任何其他工具)能否将地址解释为调用堆栈(boost上下文)的开头
- 不同的Visual Studio版本中缺少.dll
- 用Visual Studio在C++中嵌入Julia
- Visual Studio 2017循环自动向量化问题
- 有没有办法在远程设备上打开和编辑visual Studio 2017解决方案
- 尝试使用继承和模板实现CRTP.Visual Studio正在生成编译器错误
- Visual Studio在尝试读取resource.txt文件时崩溃
- Visual Studio 2017 不允许我创建 C++ 专用模板