Trouble with opening a .res file - windows

I recently obtained some files with the extension of .res
The problem I am facing right now is that I am unable to open it using different kinds of Resource Editors.
Here are the list of programs I have tried:
Visual Studio 2017
ResourceHacker
Delphi Decompiler
XN Resource Editor
And here is an example of the content of the file when opened in Notepad++: http://i.imgur.com/fcmEfED.jpg
What could be the cause of me being unable to open this file? Am I missing anything?

.res files are to .rc files like .obj. or .lib files to .cpp files - they are the compiled version of the resource definition files.
Don't expect that file to be editable by the likes of Notepad, treat it as any other compiled binary file. Especially since it really is a compiled binary file.
Having said that - when you "import" that file for use in your app you need to explicitly specify it in the list of "import libraries" (unlike a .lib file which the linker could infer from the list of dependencies). At least that is the case with MSVC++ 2015 (haven't tried it on 2017 yet)

Related

How to rename build output file in Visual Studio 2019

So I just made some c++ application, using NotificationIcon sample from Microsoft as a reference, and thus I'm stuck with the NotificationIcon.exe output file. The name is really lame and I'd like to change it. I've tried renaming the exe, renaming the solution, the project - whatever else - and my programm just exited with code 0x00 after building. What else should I try?
I tried to do the same thing, but there were a few steps I had to follow in VS2019 just to get set up. If you are not in a similar state, the rest of the answer might not apply.
Downloading the sample: I had to install the Windows 7 SDK, as the download page didn't seem to exist anymore. I'm not sure if you found it elsewhere, in which case you might be starting from different sources.
Converting the .vcproj file to .vcxproj. Visual Studio no longer supports .vcproj, and opening the solution triggered this conversion automatically.
Now, once I have a .vcxproj file, there are two routes to setting the name of the exe:
Right-click the project in VS, click Properties, and find the Target Name field. This defaults to $(ProjectName) so I would have expected that renaming the .vcxproj would have renamed the .exe file.
Edit the .vcxproj file directly, adding <TargetName>Foo</TargetName> into the section that starts with <PropertyGroup Label="Globals">

Prevent Visual Studio from using cached .pdbs

I did the following experiment: I created a statically linked C++ library solution MyLibrary (I took the code from the MSDN example: https://msdn.microsoft.com/en-us/library/ms235627.aspx.) and built it. Then I created another C++ solution MyConsoleApp, using the console application template in Visual Studio (2017). I copied the MyLibrary.lib file to the root of MyConsoleApp project and added MyLibrary.lib to Linker -> Input -> Additional Dependencies (also had to copy over the headers too of course). What I didn't do was to copy over the MyLibrary.pdb file.
I would've expected to get a linker warning about the missing .pdb file but this was not the case. Then I moved only MyConsoleApp to another machine and tried to build it again, this time getting a missing .pdb linker warning. It seems that Visual Studio is storing the .pdb files when building a solution somewhere on the machine and is able to use those .pdb files when linking other solutions on the same machine.
I would like to be able to disable this behaviour or to be able to remove the cached .pdbs so that I could be sure that when sharing work with other developers they won't get warnings that I'm not getting on my own machine.
Visual Studio doesn't cache the .pdb file. What happens here is that the absolute path to the original .pdb file is stored in the build outputs (.exe, .dll or .obj files) and Visual Studio is able to took it up based on that.
Check this answer for a way to prevent that: Remove PDB references from released file.

What is app.aps file in Visual C++?

I just discovered a misterious file in my (new) Visual Studio 2012 C++/CLI project: app.aps.
I can find no reference on the internet about it. What is it meant for? Can I safely delete it? It seems so. Should I ignore or include in my commits to source version control?
It's a generated file for designer efficiency, you can ignore it in source control:
File created by Microsoft Visual C++, a software development application; stores the binary representation of a resource included with the project; enables the application to load resources more quickly.
http://fileinfo.com/extension/aps
APS files are the binary versions of resource files. As resource editor does not directly read the .rc and resource.h files, the resource compiler turns them into the APS file.
Reference - Files Affected by Resource Editing

What are .sln and .vcproj files, and what do they contain?

I'm new in the world of Visual Studio. Can somebody please explain what these two files contain? I know that one of them contains info about project, but what about the other one?
A project file .vcproj / .vcxproj contains settings on how to compile your code into a DLL or a binary file, or something else that the linker can assemble into one unit. A project file is just an xml file that contains compiler settings, linker settings, and describes which files you want to compile.
A solution file *.slnis a text file that groups together multiple project files.
So if you think of it like a tree, then you have got a good mental picture of it like this:
.sln
.vcproj
.h
.h
.cpp
.cpp
.vcxproj
.h
.h
.cpp
.cpp
.csproj
.cs
Solution files and project files are in an XML format and describe the parts of your projects and their relations, configurations and so on. In fact, both of these files are simply MSBuild scripts (which are run through MSBuild when, you guessed it, building your project.)
This means they are easy to manipulate by hand if needs be (though this should be a rare case) and also allows to add custom parts to the build script, create custom build scripts for MSBuild that can include the solution file, among other things, or just simple auto-build scripts that pass the solution file (or project) to MSBuild, say, on version control check-in.
The difference between solution files and project files is that a project file holds information specific to that project, unaware of its solution (though, Visual Studio will look up the hierarchy to an extent in an attempt find the relevant solution when opening a project, if one exists); the solution file is aware of all projects that are part of that solution and references each of them (such as a directory of files, if you like, but with projects), it also contains solution-wide information / configuration, that can be applicable to all projects within the solution.
As pointed out by Hans Passant, there is an exception: files for C++ projects pre-VS2010 are not XML MSBuild files, but are instead a format documented by Microsoft on MSDN.
A .vcproj file contains information about HOW to compile source to a target (mostly, an executable). In many cases, it is crucial to have the project file for successful compilation, so do not delete it. It is compareable to a .dsp file (Visual Studio 6), a .prj file (Borland compilers), or a Makefile (Unix, GNU compilers) and contains paths and compiler/linker command-line options.
A .sln file is merely a collection of multiple .vcproj files. As Visual Studio can automatically create one if not present, there is no need to keep it for distribution or archiving. It's the successor of a .dsw file (Visual Studio 6). Its name "Solution file" is IMHO misleading.
In short: one is for solution, and the other is for project, and a solution can contain multiple projects.
Visual Studio allows multiple projects in a solution. The data what projects are in a solution is in the sln (solution) file.

Pointing Visual Studio 2008 to the source code of a third-party DLL for debugging

I have a VS 2008 C++ project which uses a third-party library (Open Scene Graph).
When i start debugging the project, each time a function from this external library is called, the debugger just jumps over it, because (obviously) the debugger has no .cpp files where to look up the code. It only jumps into header files which are linked to my project because those files exist and their location is known. So, i can only see what's going on in those small inline functions, but not in the bigger functions whose implementation is in .cpp files which i don't have.
I need is to somehow step thru the source code of these third-party dlls/libs the same way I do with my own code.
I downloaded the the whole source code of that library and compiled it on my machine. Now i have the dlls and libs, and the .pdb files, and the .cpp files, too. But how exactly do I tell Visual Studio the locations of the .cpp files of the third-party library, so that it knows, that when i want to step into a function coming from a .dll or a .lib it opens the corresponding .cpp file (even though it's not in my project and is located is a completely different folder)?
Is this at all possible?
I tried copying the .libs, the .dlls (debug versions), .pdbs both to the locations which my Project uses and "Additional Library Directories" and to the project's folder but this must be not enough.
Add the dir with the PDB files to Tools -> Options -> Debugging -> Symbols.

Resources