Linking multiple static .lib files into one monolithic .lib file using VS2008 SP1 without extracting .lib files first - visual-studio-2008-sp1

A basic question I have during my other question is this: Without first extracting the .lib files using the LIB.EXE command, how to I combine all .obj archive members together to form one larger monolithic .lib file? If I use the LIB.EXE or LINK.EXE utilities, some .obj files are omitted, presumably because there are no symbols defined in the omitted .obj files that are required by any other .obj file.
Without downloading and installing additional non-Microsoft software, and without first extracting all .obj files first, how do I combine them together?

You can't.
Think of a static-link .lib file as just a zipfile or tarfile containing some object files.
So you will have to find out what the contents are using lib /list, then extract each object out (one by one, that's the tedious part) using lib /extract, and once you've got everything ready, you build your new .lib.
If you're handy with a scripting language (Perl, Python, ...) it wouldn't be too hard to automate this chore. You could do it with batch commands (look for "for /F"; you'll need it) if you prefer.

Related

How to force CMake to relink project on resources change?

I have a very simple C++ executable and a few .txt resource files. At build time I embedd the .txt files into the C++ binary via linker and then I load them at runtime (based on this answer). That works great.
My problem is relinking. Whenewer I change the .cpp source of my executable and run make, the project rebuilds itself. However, if I change a .txt file and run make, the binary doesn't relink. How can I force CMake to watch changes to my resource files (.txt) so that when those change the executable gets relinked to contain the newest .txt resource files?
You can set a source property called OBJECT_DEPENDS containing the path to your .txt file. The file to set this property for should be any source that is included in your target.

UWP APPX1101 errors with 2 unique data files

I'm in the process of converting a rather huge project to a Windows 10 Store app. I've gotten it to compile and now can't get past several APPX1101 errors - "Payload contains two or more files with the same destination path". The files are .xml files part of the project, e.g. "baseDir\Assets\foo\timers.xml" and "baseDir\Assets\bar\timers.xml". Different files and different paths.
The solution and projects are created by CMake (3.72). The cmake files have been modified to support creating a Windows 10 store app platform config.
It appears that the directory tree has been flattened and files are overlapping. But how or why eludes me. Every UWP project I've seen contains an "Assets" folder under the main project but this one does not. I see files such as Logo.png and SplashScreen.png in folder named "Resource Files". The files causing the errors are under the folder named "Assets" which existed before this was a UWP project.
Primarily:
How can I fix this error? Did I misconfigure CMake?
Additionally:
How to avoid directory flattening?
There are a few hundred data files taking up a few hundred megabytes used by the program. Will I need to add each of them to the solution to be packaged?
Updates:
I've gleaned more info but not enough to fully satisfy the question. The directory flattening in the output occurs due to how the files are added to the project via CMake and how the original Windows product was packaged. The XML files are added to the project with a full path in the .vcxproj. The .vcxproj.filters also use a full path to the file and a filter like "Data\foo". The desktop Windows version didn't need to care since it knew where to find it's data relative to the executable and was packaged by an external tool.
I've manually added an "Assets" filter and modified the .vcxproj and .vcxproj.filters files. The .vcxproj file needed a property added to the file's include. This uses relative paths and gets rid of the APPX1101 duplicate error.
.vcxproj
<XML Include="..\Base\Assets\foo\Data\timers.xml">
<Link>Assets\foo\Data\timers.xml</Link>
</XML>
.vcxproj.filters
<XML Include="..\Base\Assets\foo\Data\timers.xml">
<Filter>Assets\foo</Filter>
</XML>
Update 2
From what I can tell, it's not possible to get CMake to add a <Link> to XML and other .vcxproj Include types. I went through the latest CMake source code (3.8rc). The <XML Include> is added to the .vcxproj in cmVisualStudio10TargetGenerator::WriteExtraSource() in cmVisualStudio10TargetGenerator.cxx. Other types have the option to set the flag to add the <Link> but XML and other data types do not have code to set the flag.
The only options I can see are modifying CMake source or reworking the project to add data files using relative paths that match the same <Filter> for the matching Include in the vcxproj.filters file. This is only a problem with CMake. Visual Studio 2015/2017 have no problem adding assets above your tree. The MS UWP examples on GitHub do it to share common data between sample projects.
It's been a while and I'm posting this as an answer in case someone else runs into this problem. I'm not marking it accepted because I find the workaround rather weak. My knowledge of CMake is limited and my understanding of Universal Windows apps even less.
The primary issue is that by design, CMake does not build a relocatable solution. i.e. you can't xcopy a Windows solution to another tree and expect it to work as you would would with one generated from within the Visual Studio IDE.
The second issue is that this was a huge pre-existing project already targeting multiple platforms. And by huge, I mean it ships on a dual layer blu-ray disc. The location of asset files was fixed and was above the location of the CMake build folder. This caused files to be stripped of their path when added to the layout whenever their location was not under the expected assets folder.
There is no way in the current CMake (3.8) to add a <link> tag to the include in the project file. And CMake creates the include tag with the full path to the file not a relative one by design.
The workaround I came up with was to add a step to the batch file that invokes CMake to edit the .vcproj and vcproj.filters files to change the fixed asset paths relative ones and then added another step to create a symbolic link/junction (SysInternals.com) under the build folder to the location where the assets were. The assets now appear as being under the expected asset folder are now added correctly to the layout.
As I said, not ideal but it works. The real solution would be to re-organize all the data but this is not something that can happen for this project when a vast amount of data is generated from different script, tools, sources and contributors.

Not able to create .so file in httpd-2.4.18

While I am installing httpd-2.4.18 on non stop hp, I am not able to create .so file in modules. It creates only .a file. But .so file is required in httpd.conf. How to create .so file ?
Make sure that you are using the SHARED pragma (assuming you are coding in C or C++) to make a DLL. I think that corresponds to your ".so" file.

Confused with two zlib1.dll of SDL_image extension and SDL_ttf?

Inside the SDL_image extension bin folder there is a file zlib1.dll and inside the SDL_ttf bin folder there is also zlib1.dll file,are these two files the same or different because when i tried to copy all the files under bin of SDL_ttf to widows/system32 it says "replace" or "skip this file" ,i have already install SDL_image extension and using it with code blocks 13.12.What should i do?
The files should be the same (differing only in when the were compiled) so you can safely replace one of them. Both libraries use and therefore include the zlib1.dll as they are independent from each other, but when you use both this happens.

Using Mercurial with a Visual Studio/VB.Net project

I want to start using Mercurial on a VB.Net project, but I'm not sure which files should I add. Do I include the Project.sln file, bin/ and obj/ folders?
I would recommend using the hgignore detailed in this SO post
there is one that has 100+ up votes that would be a good starting point
With every source control, you should only include source files (i.e. files that are not generated during the build process), and the complete set of files necessary to build a solution. This does include the .sln file (for ease of use of the project in Visual Studio) but not the bin and obj folders, nor (usually) the user-specific settings (.suo), nor auto-generated files that can be re-generated.
A good rule of thumb is to only include things that you cannot easily regenerate. So, source code obviously meets this role and so does resources like images, sounds, and other data you need. Objects and the actual binary you generate from the source code usually are easy to get again and generally do not need to go in.
As for the sln file, if you will be making edits to the sln file and that's how others are to build the project, then you probably want to include that as well. If you generating the sln file from some other process (e.g., a script generates the sln and then builds it from that), then it's probably a good idea to leave that out.
Here's an MSDN article called Introducing Source Control. It lists files you can and cannot add to source control.