Eric
Eric

Reputation: 21

Linking DLL in Visual Studio 2010 C++

I am trying to use the M4RI package for C++. I downloaded the source for M4RI and ran the packaged VS project. It created m4ri.dll (no .lib files). Now I want to "add" this dll file to a different VS2010 C++ project so I can use the M4RI library.

I already #include m4ri.h, but still get linking errors. How do I add this reference to the VS project?

Thanks in advance.

Upvotes: 1

Views: 2793

Answers (2)

Eric
Eric

Reputation: 21

My solution: I am not familiar with the differences between C and C++, but this seems to be the issue. To get the M4RI library to build, I had to explicitly tell it to compile with C++ (Properties->C/C++->Advanced->Compile As: "Compile as C++")

I'm not sure if this caused my problem, or if it is unrelated. To be able to use the library, I had to modify "m4ri.h" to remove the #ifdef __cplusplus sections. As soon as those precompiler directives were removed, I was able to link to M4RI easily.

I would appreciate if someone could explain why this fixed the problem.

Thanks!

Upvotes: 1

code-gijoe
code-gijoe

Reputation: 7234

Linking errors can come from many things. Are your link errors related to m4ri? With dlls, you usually get a an export lib which should be included in your project.

Upvotes: 0

Related Questions