Solved

Add/Link home grown dll to a project

Posted on 2014-01-14
7
504 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

707 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