How to get Boost threads installed on Visual C++? - installation

I'm new to multithreading and so, I wanted to start learning Boost threading. However, before I even start, I'd like to know how to get all the files working with Visual C++ 2010. As a beginner, it can be very frustrating having to deal with not just code related problems, but with a faulty installation.
Tried to find it online, but couldn't come up with any good resource.
Thanks in advance.

I had done that this week for first time too. I wanted to link it statically and apparently the installer just copy the dlls (I have to confirm this). Surely there is a better way to do it, but what worked for me was download the whole set and run the bat file that generates the lib files.
After that is just a matter of setting up the additional include and lib directories on the project.

Related

Manually compile VB6 project using LINK.EXE and C2.EXE

I would like to try and avoid the VB6.exe application when trying to compile my project. It tends to create the *.obj files and then crashes leaving me with no idea what went wrong.
"c:\Program Files (x86)\Microsoft Visual Studio\VB98\VB6.EXE" /m MyProject.vbp
I would like to try and use LINK.exe and C2.exe to compile my application instead. I found a really great article located here on the process with all the switches etc. I was hoping someone has tried something link this and been successful so they can tell me exactly what switches I need to use and a step by step process of how to create the object files and then link them all to the EXE.
I ended up getting this old source to compile. I'm sure my situation was unique but I thought I would share in hopes of helping someone else find their way if this happens to them.
First, I could NOT get this one project to compile to save my life in the end. At first it would compile in the IDE, then only by running the following in a command line...
"c:\Program Files (x86)\Microsoft Visual Studio\VB98\VB6.EXE" /m MyProject.vbp
Then that would not even work and I had to use the package and deployment wizard to compile it which worked some of the time.
I think it was really just hit or miss in the end. But at some point something pointed to a specific module file I had that was used to access (read/write) the registry. I think it was between looking at logs and maybe even the windows event viewer etc. So I started thinking... Maybe it will compile if that was not used. So I removed the module from the project, tried to compile, then VB was nice enough to show me every call that would not work because the referenced function did not exist. I commented out all of those as well then I was able to compile with very little effort and it went smooth again!
So that helped me identify what VB was flipping out about but it did not solve the underlining issue (that I could not compile ALL of my source). So I started trying to work all the source back into the application one by one to see where it would break at.
I first added the module file to the project and just compiled.
Success!
I then tried to uncomment the first thing I commented out (reference to the function in that module) and then recompiled.
Success!
I managed to get all the way back through all my commented out lines of code and put them back the way they were originally. I then recompiled for the final time.
Success!
So at this point I had EVERYTHING back to the exact way I had it before I started trying to compile. Now it works with no issues at all!

How to use third party SDKs/Libraries in Visual Studio (2010) projects? (OpenGL/FreeGLUT/GLEW)

For the last two years I have been using Java and NetBeans, where all I need to do to add a new third party library to my project is throw in the .jar file and NetBeans does the rest.
Recently I have switch to C++ and Visual Studio and I am having a really hard time getting a project to compile using OpenGL, GLUT and GLEW due to 'Missing reference' errors.
Some tutorials tell me I need to download the projects for GLUT/GLEW and run them (that didn't work), some tutorials tell me I need to add a .dll file to my Win32 folder, others say just put the header files in the same directory as your project and some say I need to install these libraries in to Visual Studio itself, not just to my project.
None of these approaches have worked thus far.
All I want is for this one project to use these libraries. This is throwing a major spanner in the works for me at the moment, any help would be appreciated.
Sorry, I don't have an easy answer for you. I've been using OpenGL on Windows for years, and it can be a pain.
MS doesn't even (really) support OpenGL, the headers that come with Windows are the old 1.x ones - and they have no plans on changing that (they want to you use DX).
So, I would start small.
First, get a basically empty Win32 console "Hello World" app running.
Then, just add one component, like Glut.
Then, do the same - keeping it compiling / linking - incrementally add other components.
Wherever they tell you to put headers, libraries, DLLs, etc, it needs to be reflected in your project file. So:
add the location of the header files to "C/C++->Additional Include Directories"
add the .lib files to the "Linker->Input->Additional Dependencies"
(it still won't find them so) add the location of the .lib files to "Linker->General->Additional Library Directories"
With all that in place it should compile and link, but may not run still because it can't find the DLLs (that go along with the .lib files).
The shortest path to getting running might just be to dump the DLLs in the Windows/System32 folder. But in the long run that can be problematic as other apps may overwrite it (or see you as overwriting theirs).
What I do with specific DLLs is just load them explicitly in my application so I know for sure what DLL I'm getting (I don't do much Windows-specific GL, but when I did, I had my own \OpenGL directory with the versions of .h files, libs and DLLs I wanted).
Good Luck!
Oh, LoadLibrary() will load a DLL, etc.

VS 2010 project reference looking for incorrect version

We have recently taken over a project from an outsourcing company. This project uses Moles and Pex for unit testing, but since we have not had the project for long, I am not very familiar with the frameworks.
That being said, we are busy upgrading this project to run in .Net 4. I have resolved most of the issues that have jumped out, but there is one that I cannot get a handle on. Some of the unit tests cannot compile because of the error:
Could not load file or assembly 'Example.Assembly, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified.
The part that baffles me is that it is a project reference and the assembly is being copied to the output directory of the unit test. Most of the other project references are found and I cannot spot any difference between the ones that work and the ones that do not. I am not sure if this problem has to do with the pex/moles frameworks, but I thought I would mention it.
I have tried the usual things of removing and adding all the references and regenerating the moles assemblies.
Has anyone else run into this problem? Any help would be greatly appreciated.
EDIT1: Ok, after some more investigation into the build output, it appears as if it is not moles, but the .accessor files that are not generated correctly. I get the exact same problem as asked in Unit test project cannot find assembly under test (or dependencies), but unlike his problem, mine does not go away after deleting the accessor.
EDIT2: Turns out is is a program called Publicize.exe which falls over with that error. Still no idea why though. Looking at Fusion logs is looks like it does not search under the working directory for the dll that it is trying to generate the accessors for. Running it manually on a bunch of assemblies from our solution, I find it works on some, but not on others. I have not been able to identify a difference between the ones that work and the ones that don't, though.
Thanks
Ah, yes. I have read this story many times, and have the tee shirt. I run through my usual Moles first-aid kit, when encountering any issue, including this one.
Perhaps, this question will provide some help: Am I the only one getting "Assembly Not Available in the Currently Targeted Framework"?
Ensure the Moles framework is properly installed on the workstation and/or build server
Ensure the Moles assemblies are being built (see the excluded "Moles Assemblies" directory)
Check your build profile -- it may need to be set to full framework profile
Triple check your output destinations and post-build commands -- I have seems some solutions that copy the output to another location
Try using the Visual Studio Pex/Moles extension, if you are not already doing so
An invasive fix-all process is to simply create an all-new solution, projects, and test projects, and then copy the existing code files into them. It's surprising how many issues can be resolved for various project-related errors. Basically, a hard reboot for the entire solution.
Since you are updating to .NET 4, you may as well go to 4.5, and used the productized version of Moles, called "Fakes". You'll find Fakes in the Visual Studio 2012 release candidate. This significant feature hasn't received much attention.

Programmatically grabbing DLL manifest information with Python or other common scripting language / tool

I am having a problem like this one:
http://svn.haxx.se/tsvnusers/archive-2008-07/1051.shtml
Except that the app is our own (sorry, won't give you confidential details). Although, it is not our fault that SideBySide is so flawed.
Anyhow, version X works and version Y bombs right at the start. I am facing the task of walking through a bunch of directories and up to 100 dll files to figure out what the difference may be.
It looks like there is a conflict between two dll files which load two different versions of another dll file.
I would appreciate your help with a Python / other snippet for extracting a manifest from a given file. Thanks!
EDIT: By the way, I did find a way: I can run the following command (mt.exe is part of Visual Studio 2008 Tools): mt.exe -inputresource:MyFile.dll;#2 -out:MyFile.dll.extracted_manifest.txt.
This is a good start, but there are two problems with it:
There can be multiple manifests embedded (In my understanding): #1, #2, #3, ... - I do not know which ones and how many ahead of time. What is the maximum?
If I take a guess and run mt.exe with that parameter, I get a failure. Dealing with these errors would make the script longer.
Could someone shed some light on this please?
ANOTHER EDIT: Ah, never mind! 1 is for .exe, 2 is fo dll and that is it. I guess I know what to do now. However, if you have a solution which beats mine, or if you have automated calls to mt.exe from a Python / other script, then feel free to share it.
A manual brute-force (clicking) approach worked faster. Took only a few hours.

Change the location of the ncb file in Visual C++ 2008 (9.0)

I´ve tweaked the VC++ settings so that all of my actual code will go to one place, while compiler generated binaries will go to another. This ncb file is the exception though. It is a quite large IDE generated binary file (Intellisense database). I can´t seem to be able to move it anywhere other than the solution folder. I´ve reasearched on google and found a few references saying that this is impossible. Does anyone have a workaround?
Visual Studio doesn't allow you to move that file. This article on CodeProject shows how one person worked around this problem, by creating a "poor man's" version of symbolic links. This involves hooking Windows' CreateFile function. This approach seems like overkill to me; I think I would just learn to live with this limitation if possible.

Resources