How to link a static library into my program by Dev-C++?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
superwzj
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Jul 31, 2008 12:24 pm

How to link a static library into my program by Dev-C++?

Post by superwzj » Thu Jul 31, 2008 12:34 pm

hey,guys
i'm a pretty newbie for programming, and the mission now is to compile a static library into my program, instead of a dll, because by this way, the user of application can work well without those dlls on their computer.

i know it's very common to do this by Dev-C++,but i really can't find how to do that on google.

For example,i have two library need to compile, all of them comes from openSSL, libeay32.dll and ssleay32.dll, and i also have the static ones, libeay32.a and ssleay32.a.

please note that,i need static link the library.

anyone can help me?

liuqi5521
Earned some good credits
Earned some good credits
Posts: 103
Joined: Thu Apr 03, 2008 5:35 am
Location: China
Contact:

Post by liuqi5521 » Thu Jul 31, 2008 2:15 pm

hi , click menu item [project] -> [project options],
and select the tab "parameters",you should input "-leay32" into the textbox on the right side of the panel.

superwzj
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Jul 31, 2008 12:24 pm

Post by superwzj » Thu Jul 31, 2008 2:20 pm

liuqi5521 wrote:hi , click menu item [project] -> [project options],
and select the tab "parameters",you should input "-leay32" into the textbox on the right side of the panel.
thanks, man..

but i think i must tell the linker where are those two libraries,right? how can i do that by -leay32?... i really have no idea about linker commands...

NinjaNL
Moderator
Moderator
Posts: 899
Joined: Sun Oct 03, 2004 10:33 am
Location: Oosterwolde, Netherlands

Post by NinjaNL » Thu Jul 31, 2008 8:26 pm

superwzj wrote:
liuqi5521 wrote:hi , click menu item [project] -> [project options],
and select the tab "parameters",you should input "-leay32" into the textbox on the right side of the panel.
thanks, man..

but i think i must tell the linker where are those two libraries,right? how can i do that by -leay32?... i really have no idea about linker commands...
Project - Project Options (Alt + P)
Select the Directories tab
Press the browse button, then browse to the location of these libraries (assuming that they were not installed into %DEV-CPP%\lib automatically)
Press OK
Press Add
Press OK

Now try and compile/run your program

OR

Project - Project Options (Alt + P)
Select the "Additional Command-line Options" tab
Click "Add Libvrary or Object" button
Browse to the library file (NOTE - the file itself libeay32.a)
Select Open

The additional library will have been added to the bottom of the list of library files.

Select the new text, press Ctrl+X,Place the caret at the beginning of the library list,Press Ctrl+V
Press OK

Now try and compile/run your program


Option 1 is better.

In effect
Follow the development of my screenplay authoring program at http://wxscreenplaywriter.blogspot.com/

Post Reply