Solved

Add/Link home grown dll to a project

Posted on 2014-01-14
7
481 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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 30

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 30

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

20 Experts available now in Live!

Get 1:1 Help Now