0

I have correctly compiled Boost for Windows 8 with VS-10 as given in this link. My project works fine. But when I copy the project to another Windows 7 machine it returns an error message as "The application was unable to start correctly (0xc000007b). Click OK to close this application.". I have correctly installed Boost in the second PC as well. Both PCs are 64-bit and I installed 32-bit Boost in both. As I found from some links this is because the project try dynamically linking 64-bit libraries instead 32-bit. Could you kindly advice how to build this as a portable solution. Thanks in advance.

Update 1: Following is the dependency walker output. enter image description here

Huá dé ní 華得尼
  • 1,248
  • 1
  • 18
  • 33

1 Answers1

1

Are you sure you selected the Visual Studio 2010 Command Prompt x86 to compile the library? or the x64 version? there is more than 1 version of the command prompt in the start menu. my guess would be that you accidentally ran the x64 version, and then compiled boost with it, resulting in a x64 bit version of the library compiled.

Here's a batch file that compiles the static and shared version of boost in x86:

compileboost.bat:

call "%vs110comntools%..\..\VC\vcvarsall.bat" x86
cd C:/boostsourcefolder/
call bootstrap.bat
.\b2 runtime-link=static
.\b2 runtime-link=shared

Then in your VS2010 project properties, Common Properties -> VC++ Directories -> Include Directories, type your boost folder (C:/boostsourcefolder/). and in Common Properties -> VC++ Directories -> Library Directories, type the boost compiled library folder (C:/boostsourcefolder/stage/lib/).

That's pretty much all you need to do.

J-Mik
  • 896
  • 7
  • 8
  • There are three command prompts in both PCs as Visual Studio Command Prompt (2010), Visual Studio x64 Cross Tools Command Prompt (2010), and Visual Studio x64 Win64 Command Prompt (2010). I used the first one (Visual Studio Command Prompt (2010)) for compile in both machines. Should I use another version? Thank you. – Huá dé ní 華得尼 Jun 02 '13 at 03:35
  • It should be the right one, I updated my reply in case more details might help you – J-Mik Jun 02 '13 at 03:50
  • I am just curious whether what I did using the following two commands are completely different than what you are suggesting or not. Please kindly advice. I first ran "bootstrap" and then "bjam toolset=msvc-10.0 variant=debug,release threading=multi link=static" in the boot source folder. – Huá dé ní 華得尼 Jun 02 '13 at 05:33
  • I did as you suggested using the given bat file. But still the problem is there. Any suggestion? – Huá dé ní 華得尼 Jun 02 '13 at 07:10
  • Have you tried creating a new project and compile it to see if it works? For your current project, try Build -> Clean Solution, then Build -> Rebuild solution, to see if that solves the issue. – J-Mik Jun 02 '13 at 13:37
  • Also, try completely deleting your boost directory, then extract it again + compile it. – J-Mik Jun 02 '13 at 17:25
  • I recompiled the library as said and now VS returns the error "Error 5 error LNK1104: cannot open file 'libboost_thread-vc100-mt-gd-1_53.lib'". And there is no such file in the "Boost/stage/lib". There are similar two files as "libboost_thread-vc100-mt-s-1_53" and "libboost_thread-vc100-mt-sgd-1_53". Thanks. – Huá dé ní 華得尼 Jun 09 '13 at 09:09
  • I just copied the boost folder from original pc to the other one, but error is still the same "The application was unable to start correctly (0xc000007b). Click OK to close this application". I updated the question with a screen capture of the dependency walker. Please help. – Huá dé ní 華得尼 Jun 09 '13 at 11:24
  • you're close, to fix the "Error 5 LNK1104" you need to compile with runtime-link=dynamic. So simply remove the line ".\b2 runtime-link=static" in my "compileboost.bat" batch file, and execute it again. I'd recommend extracting the original source file, and not copying it from another PC. – J-Mik Jun 09 '13 at 11:52
  • I apologize, I typed "runtime-link=dynamic" in my post, however the real flag is "runtime-link=shared". that explains why it can't find 'libboost_thread-vc100-mt-gd-1_53.lib". I updated my post, simply execute the .bat file again, with the source extracted from the original source archive, and build it again. – J-Mik Jun 09 '13 at 11:59
  • I'm little confused about whether I should remove the line ".\b2 runtime-link=static" or not. Thanks a lot. – Huá dé ní 華得尼 Jun 09 '13 at 14:13
  • well, in fact it doesn't really matter, but keep it there, in case you'll use the static runtime later. – J-Mik Jun 09 '13 at 16:09
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/31498/discussion-between-hwathanie-and-doesntmatter) – Huá dé ní 華得尼 Jun 10 '13 at 00:31
  • I extracted a fresh copy and ran the "compileboost.bat", but error is still the same (The application was unable to start correctly (0xc000007b). Click OK to close this application). And same errors can be seen in the dependency walker as last time. I am stuck in this point now for several weeks. Please help. :-( – Huá dé ní 華得尼 Jun 10 '13 at 00:36
  • Now it works, what a relief ;-). I created a new application in Windows 7 and shared it with other Windows 7 and Windows 8 machines. Now it works in all three machines. But it is just a workaround. Not the proper solution. Thanks a lot for all your helps. Really appreciate it. – Huá dé ní 華得尼 Jun 10 '13 at 04:46