PDA

View Full Version : .lib and .a file considerations when using DLLs?



Rusty Nails
10th January 2013, 18:59
Hi, I'm attempting to start writing a GUI program that must make use of an open source DLL called "epanet2". I've done some google searches on the topic and they seem to only lead to more and more google searches.

I originally attempted to use this guy's method:

http://www.youtube.com/watch?v=EIcysZtl8AE

He just adds the following to project file after compiling the DLL.

INCLUDEPATH += "C:/Users/Gangming Zhang/Desktop/Epa_Toolkit/include"
LIBS += "C:/Users/Gangming Zhang/Desktop/Epa_Toolkit/epanet2.lib"


However upon adding "#include <epanet/epanet.h>" to main, I get an error saying "can't find file epanet.h ". I then tried creating a new project file called epanet.h and pasting the source into it, and then calling it from main via "#include "epanet.h". This leaves me with about 50 compiler errors such as "C4518: 'int ' : storage-class or type specifier(s) unexpected here; ignored" and others.

After some further googling I found the issue may be I'm attempting to use a .lib file (for MSVC) instead of a .a file for MinGW. (I'm using Qt with MinGw)

What are my options here? I have the library source and the makefile, but I'd like to avoid messing with them if possible... don't want to screw anything up.

I assume I could either a) Reinstall QT with Microsoft Virtual Studios or b) Attempt to compile the library with MinGW instead of Virtual studios to produce a .a file?

Which of these do y'all think makes more since? Or are there any other options I'm not aware of?

Much thanks,

Hunt

Santosh Reddy
11th January 2013, 08:55
You already figured out the options you have.

I will say try recompiling epanet with MinGw (as you already have the it setup), installing Qt for MSVC, or compiling it with Qt with MSVC will take some time.