简体   繁体   中英

Visual studio 2010, PortAudio DLL compile and linking issues, C++

Hi stack overflow users.

Error description:

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

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; }

I get this error message: fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory

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

My attempt:

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

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

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.

该文件夹中包含.DLL和.Lib文件告诉链接器要包含哪个库告诉项目要包含哪个目录(在这种情况下,.DLL和.Lib所在的文件夹

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM