Visual Studio 2010,PortAudio DLL 编译和链接问题,C++ [英] Visual studio 2010, PortAudio DLL compile and linking issues, C++

查看:51
本文介绍了Visual Studio 2010,PortAudio DLL 编译和链接问题,C++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好堆栈溢出用户.

错误描述:

对于一个小项目,我决定使用 portaudio 库(我使用 Windows 7 64 位和 C++):http://portaudio.com/

For a mini project I have decided to use the portaudio library (I use Windows 7 64-bit and C++): http://portaudio.com/

在使用库之前,我必须在另一个 Visual Studio 项目中构建一个 .DLL 文件,然后将输出链接到我自己的 Visual Studio 2010 项目(32 位).我尝试使用这段简单的代码:

Before even using the library I had to build a .DLL file in another Visual Studio Project and then link the output to my own visual studio 2010 project (32-bit). I tried to use this simple piece of code:

#include <iostream>
#include <portaudio.h>
using namespace std;
void main()
{
  cout << "Hello World!" << endl;   cout << "Welcome to C++ Programming" << endl; }

我收到此错误消息:致命错误 C1083:无法打开包含文件:'portaudio.h':没有那个文件或目录

我个人认为 .DLL 的创建不是问题,而是链接问题.

I personally don't think it is the creation of the .DLL that is the issue but more a linking issue.

我的尝试:

首先,我尝试遵循本指南:http://portaudio.com/docs/v19-doxydocs/compile_windows.html

First of all I have attempted to follow this guide: http://portaudio.com/docs/v19-doxydocs/compile_windows.html

按照本指南,我在发布文件夹中得到了一个编译好的 .DLL 和 .Lib 文件(图 1):

By following this guide, I got a compiled .DLL and .Lib files inside the release folder(Image 1):

之后我尝试将我的 Visual Studio 2010 与 portaudio_x86.lib 链接并包含它所在的目录(.DLL 创建的输出文件夹)(图 2 和图 3)

Afterwards I try to link my visual studio 2010 with portaudio_x86.lib and include the directory where it is located (The output folder of the .DLL creation)(Image 2 and 3)

我自己在使用外部库方面的经验很差,自己编译它们的经验甚至更少.我对以前的编程只有一点经验,所以我很确定只是我错过了一些重要的东西.

I myself have very poor experience with using external libraries and even less experience when compiling them yourself. I have only a little experience with previous programming, so I am pretty sure it is just me missing something vital.

推荐答案

编译器无法找到 portaudio.h 头文件.根据最后一个屏幕截图,在 Additional Include Directories 中,您需要指向 文件所在的目录,而不是二进制文件(.lib, .dll) 是..lib 文件的路径需要明确指定(如上一个屏幕截图的旁边,不仅仅是 portaudio.lib 而是完整路径)或设置VC++ 目录 属性页,这也是设置包含目录的首选位置.

The compiler fails to find the portaudio.h header file. As per the last screenshot, in Additional Include Directories, you need to point to the directory where the <portaudio.h> file is, not where the binaries (.lib, .dll) are. The path to the .lib file needs to either be specified explicitly (as in the next to the last screenshot, not just portaudio.lib but the full path) or set in the VC++ Directories property page, which is also the preferred place to set your include directories.

这篇关于Visual Studio 2010,PortAudio DLL 编译和链接问题,C++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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