简体   繁体   中英

How to reference/including external source files/libraries in C with Visual Studio?

Trying to create a C project that references this so that I could use it in my own application. Unfortunately I'm having a bit of trouble. I'm a C# programmer and in that language it is very simple. First you reference the library and then you use the using keyword.

However, considering I have never programmed in C before I'm having a bit of trouble with this simple task. I tried just copy and pasting all the source files in to my project directory where my main class was also stored but it still couldn't be found. I also tried including the compiled DLL but got the same error:

error C1083: Cannot open include file: 'mpir.h': No such file or directory

I'm reading the documentation for it and it says to only do this at the top of your source file:

#include <mpir.h>

Which is what I'm doing but it does not seem to be working.. Any suggestions?

If mpir.h is in the same directory as your source file, you need to use the include directive with quotations instead of brackets, like this:

#include "mpir.h"

Take a look at Wikipedia's description of including files .

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