creating .lib file in Visual Studio - visual-studio

I feel like an idiot asking such a basic question but for the life of me, I can't find much on this topic.
Anyway, how does one go about making a .lib file using Visual Studio (or whatever tool)?
Let's say I have a project or work space with one .cpp file and .obj in it.
TIA, Mike

Go to Project->Properties. Under "General" set "Configuration Type" to "Static Library (.lib)". Then under "Linker" change the extension of the Output File to .lib . Then you're good to go. Remember to do these for all your configurations (Debug, Release etc.)

To create a new static library project
From the File menu, select New and then Project….
On the Project types pane, under Visual C++, select Win32.
On the Templates pane, select Win32 Console Application.
Choose a name for the project, such as MathFuncsLib, and enter it in the Name field.
Choose a name for the solution, such as StaticLibrary, and enter it in the Solution Name field.
Press OK to start the Win32 application wizard. On the Overview page of the Win32 Application Wizard dialog box, press Next.
On the Application Settings page of the Win32 Application Wizard, under Application type, select Static library.
On the Application Settings page of the Win32 Application Wizard, under Additional options, clear the Precompiled header check box.
Press Finish to create the project.
See here for more details.

Go into proprties->Configuration Properties->General->Configuration type.
There you want to choose static library (.lib).
Then you just have to build it.

look at the project properties. There will be one that says something like output type, you just choose library, as opposed to .exe.

Related

How To View the Project > References Tab and All DLL Paths in non-VB projects?

When you create a VB project in Visual Studio there is a 'References' tab in the Project Properties window. It looks like this:
It's rather a helpful window as it shows the paths to all the referenced DLLs in one place and lets you add and remove references easily.
However this same tab does not appear for projects in other languages making it very difficult to check the path for each referenced DLL.
Can this tab be made viewable or available for other projects? If not, what is the simplest way to view all the referenced DLL paths at once?
Unfortunately the reference tab for the other languages does not exist.
But you can try to edit the xml project, with these steps:
Show the context menu on your project in the window solution explorer
Select: Unload project
Right click and select Edit
Edit the ProjectReference element in xml file
Save and close xml
Reload Project (right click in solution explorer)
I know this is not what you wanted, but it could be a quick alternative to display the path of your references.

How to give author, publisher name in visual studio 2010 for VC++ project

I tried following plenty of questions in this forum to give author or publisher name when the ouptut .exe is double clicked. But I am unable to help myself. One of them which I followed was this one. In the picture shown in the accepted answer, I am unable to find any manufacturer name. Also, I am not able to find "setup project in the solution explorer" which seems to have been told in many posts. Please can anyone help me giving answer step by step? I use visual studio 2010.
give author or publisher name when the ouptut .exe is double clicked
Double-clicking an EXE will start it. If you want to see the version resource then you'll need to right-click it, Properties, Details. Note how the linked question talked about a Setup project, not a C++ project.
To add a version resource to your EXE, you'll first need to add a resource file. Check if your project already has a .rc file. If not, use Project + Add New Item, Resource node, pick the "Resource File (.rc)" item template.
Double-click the .rc file in your project to open the Resource View window. Right-click + Add Resource and pick Version. Fill in the fields of the resource as needed. Use the CompanyName field for the manufacturer.

Problem with file name folding in Visual Studio Solution Explorer ("File Nesting")

(Edit for search-ability: called "File Nesting")
I'm not sure if "folding" is the correct term, but the feature I'm referring to is shown in the 1st image below, versus the 2nd one which does not have an expandable tree list node for the code behind file.
Folding:
No folding:
My questions are:
What is the correct name of this feature?
How do I set it?
Why does my Solution Explorer not have this feature enabled when I try to convert my Web Site Project to a Web Application Project?
References:
Upgrading VS 2005 Web Site Projects to be VS 2005 Web Application
Edit
Thanks Sean, but as you can see below, my Nest Related Files button does show up in this project for some reason:
Should have button shown below:
Edit:
I figured out the reason: I accidentally created a C# Web Application Project, and then added VB ASP.NET files to it.
It's called File Nesting.
When a website project is selected in Solution Explorer, the third button in the Solution Explorer toolbar is for "Nest Related Files".
A website project or project file must be selected in Solution Explorer (rather than the root Solution), for the button to appear in the toolbar. The command/tool button is not available when C++/C# projects are selected in Solution Explorer. I don't have a web app project to test but can only conclude that the command is not applicable to web app projects either.
see this related question for a possible registry hack (changing 9.0 to 8.0 in the question's reg script):
Visual Studio 2010 related file nesting
When you are not using a website project, the nesting button in the solution explorer won't appear—but you can still nest files in .NET 5.0 projects.
Here's how you do it:
Open the project's .csproj file. Visual studio can open it in its own viewer, or else you can use your favorite XML or text editor.
Locate or create an appropriate Item Group element. If there's already one that includes some of your files, put it in there for cleanliness and consistency. If there isn't, create a new one.
Create a new Content element for the file you wish to nest. This element's Include attribute should be the name of your desired file.
Add a new DependentUpon child element to your content element. This element's text value should be the name of the file you wish to nest your target file underneath.
Save the project file and Visual Studio will likely prompt you to reload the project. If you did it correctly, your target file should now be nested under your desired file.
There's shockingly few questions and answers that address this situation. The above answer didn't help me, so I figured that I would share what did for posterity.

Embedding a XAP file into a class library

This might be a bit tricky setup but...
I have this Silverlight project that builds into a XAP, which is all fine.
Next we have this set of class libraries we add to an existing application which then unfolds into small "applications" inside the existing one.
The problem here is...
I want my XAP to be embedded into the class library as an embedded resource, but I'm looking for a solution how to do this without some half-dodgy post-build event if possible. It would be fantastic to be able to link the output of my Silverlight project to the class library and get it embedded...I guess I'm starting to ramble a bit now ;)
Short version: link Silverlight project to a Class library project as an embedded resource...is it possible, if so how?
In the required spot in the solution explorer of your class library, right click, "Add-> Existing Item", then in the file browser that pops up change the file filter to "All", browse to the ClientBin folder of your web project (or the Bin folder of your Silverlight project), select the xap file, but don't just click 'Add', instead click on the down arrow on the button and click 'Add as link'. Then go to the properties of the newly added xap file, and change its Build Action to Embedded Resource.
No dodgy post build events required :)

How to set the Startup Project in VB6?

Can you set the startup Project in the Visual Basic 6 IDE?
I looked all through the Settings and can't find a way to do it.
I assume you have multiple projects in a Group e.g. a dll and a dependent exe and you want to set the exe as the 'start up' project. Do so this, select the exe project in the Project Explorer, right click and choose 'Set as Start Up' from the context menu. The 'start up' project's name will be shown as bold text in the Project Explorer.
Dave and OneDayWhen are correct in saying that you need to right click the desired project in the IDE and select Set as Start Up when you have multiple projects loaded and you want to choose which one is executed.
Anyone know how I can set the VB6 IDE
to load either the last project loaded
or change the default one loaded?
Copy the Icon change the target to something like
"C:\Program Files\Microsoft Visual Studio\VB98\VB6.EXE" "D:\MyProjects\MyOneProject\trunk\MyOneProject.vbp"
Change Startup In to D:\MyProjects\MyOneProject\trunk
I found it more just to change the StartupIn to my Master Project Directory rather than have icons for specific project. Like D:\MyProjects
Rob Conley
P.S. In case you are wondering on why you would ever select a non-EXE project as startup. You do this at times when you are debugging a non-EXE. When you startup a non-EXE you have several options. Among them you can fire up a application,or have sit there until something calls it. Useful when you are debugging a Active DLL or Control and using Excel or another 3rd party software that you don't have the source too.
I'm not aware of a "startup Project" settting in VB6, but you can select the "Startup Object" by opening the Project menu, choosing the last menu item ("X properties", where X is the name of your project), and then selecting the General tab in the Project Properties window. The selector you seek is in the upper-right corner.

Resources