Solved

Add/Link home grown dll to a project

Posted on 2014-01-14
7
490 Views
Last Modified: 2014-01-16
I have created a dll, and would like to link that to a project that I am working on,  The MSDN documents suggest that I use Project->References->Common Properties->Add New Reference, but when I do, there is nothing there.  MSDN also suggests that I press the BROWSE button, but that button doesn't exist.

Any help will be greatly appreciated.
0
Comment
Question by:rickhill11
  • 4
  • 2
7 Comments
 
LVL 3

Expert Comment

by:fredvr666
ID: 39779434
What version of Visual studio you are using?
0
 

Author Comment

by:rickhill11
ID: 39779437
Sorry, VS2012 VC++
0
 

Author Comment

by:rickhill11
ID: 39779562
When I click on Add New Referenced I get a new dialog with "No items found", and there is not a Browse button.
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

Author Comment

by:rickhill11
ID: 39779624
I used the old fashioned way referenced in the document which worked.  But I still wonder why Add New Reference doesn't work.
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 39779860
Hi rickhill11,

before you can use Add New Reference you have to add the DLL's project to the solution. I don't exactly know how this works in VS 2012, in VS 2010 you i.e. can use menu File->Add->Existing Project and select the VCXPROJ file of your DLL's project.

ZOPPO
0
 

Author Comment

by:rickhill11
ID: 39779949
Worked perfectly, Thanks!


Some of the resultant software will be distributed via Dropbox, and I don't want to have to keep track of DLLs on other people's computer.  How can I make a specific project statically link the project that I added via "Add New Reference?"
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 39779987
Hm - to do this you'll have to change the DLL project's settings to build a static library instead of a DLL.

Usually that's not a big deal. I would suggest to add a configurations like i.e. Release Static (as copy from Release) and Debug Static (as copy from Debug). If you think you won't every need to use the project as a DLL you can skip this, in this case simply ignore these new names below and change the mentioned settings directly in Release and Debug.

In these two new configurations then change the project settings Configuration Properties->General->Configuration Type from Dynamic Library (.dll) to Static Library (.lib).

Further if you really want to only distribute the EXE you should link the runtime (and, if used, MFC too) statically into the EXE too.

To link Runtime Libraries statically set Configuration Properties->C/C++->Code Generation->Runtime Library to Multi-threaded (/MT) in Release Static and Multi-threaded Debug (/MTd) in DebugStatic.

To link MFC statically set Configuration Properties->General->Use of MFC to Use MFC in a Static Library.

At last you may have to configure the new configuration is used in Build->Configuration Manager ... - there simply for the DLL-project select Release Static for the solution's Release configuration and Debug Static for the solution's Debug configuration.

Usually this is enough to linke everything needed into one single EXE. Please take care I only can tell how it is in VS 2010, it maybe some menue items or property names may differ in VS 2012.

Hope this helps,

ZOPPO
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now