Solved

Run-time error while working with boost libraries and vs 2005

Posted on 2010-09-09
13
940 Views
Last Modified: 2013-12-14
Hi Experts,

I am very new to this world of boost and I am trying to run some code that I found on the boost.org website.
I am using vs2005 EE and the latest boost_1_44
I have set the application properties correctly I guess:
C/C++ to point to boost/boost_1_44  folder
and Linker to point to boost/boost_1_44/lib folder
I don't get any compiling error:

.................
1>        ]
1>        c:\program files\microsoft visual studio 8\vc\include\xstring(1210) : see reference to function template instantiation 'wchar_t *std::_Traits_helper::move_s<_Traits>(wchar_t *,size_t,const wchar_t *,size_t)' being compiled
1>        with
1>        [
1>            _Traits=boost::tokenizer_detail::traits_extension<traits_type>
1>        ]
1>Compiling manifest to resources...
1>Linking...
1>Embedding manifest...
1>Build log was saved at "file://c:\Documents and Settings\user1\My Documents\Visual Studio 2005\Projects\TheBoost\Debug\BuildLog.htm"
1>TheBoost - 0 error(s), 8 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

But when I run the program I get the following error message:
"The application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix the problem. For more details, please see the application event log"

What does this mean? Which configuration is incorrect, in this code or it is the compiler configuration or something...
 The application I am running a simple one that should just display Hello, world on the screen after 5 seconds(I have attached the code).
 
Thanks for your help.


#include <iostream>

#include <boost/asio.hpp>

#include <boost/date_time/posix_time/posix_time.hpp>



int main()

{

  boost::asio::io_service io;



  boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));

  t.wait();



  std::cout << "Hello, world!\n";



  return 0;

}

Open in new window

0
Comment
Question by:Smanyx
  • 7
  • 5
13 Comments
 
LVL 40

Expert Comment

by:evilrix
ID: 33640289
Are you sure you didn't accidentally create a managed code project?

I use asio prolifically in VS2005 without any issues.
0
 
LVL 12

Expert Comment

by:trinitrotoluene
ID: 33643551
This is because version 8 of the VC compiler(VS2005) doesn't support some of the Boost features of the specific Boost library you are using. If you look at your warnings carefully you would notice this. The configuration mismatch is also because of this.

Check whether you have the latest updates to 1_44

0
 

Author Comment

by:Smanyx
ID: 33644123
>> Are you sure you didn't accidentally create a managed code project?

I have created a win32 console application.

>> This is because version 8 of the VC compiler(VS2005) doesn't support some of the Boost features of the specific Boost library you are using

Is there anything that should be done in order to use these features ? What ? or how?

>> Check whether you have the latest updates to 1_44

The version I have has been downloaded just a week ago from the boost website. I assume it's the latest release. I don't know if there is any SP or updates to it yet...
0
 
LVL 40

Expert Comment

by:evilrix
ID: 33644354
>> This is because version 8 of the VC compiler(VS2005) doesn't support some of the Boost features of the specific Boost library you are using.

That's not true. Like I said above, "I use asio prolifically in VS2005 without any issues". I am not aware of any compatibility issues with Boost. I'd be surprised if it's not even getting passed the program loader (try putting a breakpoint in main, does it ever get hit?).

The only time I have seen this error it turned out to be related to missing runtime framework code. More specifically Microsoft.VC80.CRT was not being located.
http://msdn.microsoft.com/en-us/library/ms235342(VS.80).aspx

A few things to try...

1. Make sure you have the lastest VS2005 service pack installed.
http://support.microsoft.com/kb/928957

2. Edit the manifest file and check the version of Microsoft.VC80.CRT it is expecting exists on your machine. If it doesn't you should probably run a VS repair install although (IIRC) the way we resolved this was just to install the VS2005 redist.
http://www.microsoft.com/downloads/en/details.aspx?FamilyId=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en
0
 
LVL 40

Expert Comment

by:evilrix
ID: 33644382
>> VC compiler(VS2005) doesn't support some of the Boost features
It is true that Microsoft in their misguided arrogance decided to add warnings for some standard C++ features to try and scare you into not using them. You can tell the compiler to behave properly by adding _SCL_SECURE_NO_WARNINGS to the preprocessor section of your project.

http://msdn.microsoft.com/en-us/library/aa985974(VS.80).aspx

This is an issue with the compiler and NOT with boost not is it a compatibility issue... the code still builds and works fine.
0
 

Author Comment

by:Smanyx
ID: 33645441
>> I'd be surprised if it's not even getting passed the program loader (try putting a breakpoint in main, does it ever get hit?).

The problem is I can't even get the program to run !!
After the successful compilation, when I hit the run button, I just get the error message I describe in my initial post.

>> A few things to try...
>>1. Make sure you have the lastest VS2005 service pack installed.

I have downloaded and installed VS2005 service pack 1 that I didn't have

>>2. Edit the manifest file and check the version of Microsoft.VC80.CRT it is expecting exists on your machine

Here is the content of the manifest file, not that I understand what it contains...

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" version="8.0.50727.4053" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>

The program still doesn't run.
Any other suggestions?
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 40

Expert Comment

by:evilrix
ID: 33645535
>> The problem is I can't even get the program to run !!
>> After the successful compilation, when I hit the run button, I just get the error message I describe in my initial post.

Indeed, this is exactly what I meant.

>> The program still doesn't run.
>> Any other suggestions?

The issue is almost definately related to Microsoft.VC80.DebugCRT. Have you checked that it is on your machine, in the correct search path to load a DLL and that it is version 8.0.50727.4053?

Did you see the link I posted about this issue? This explains the possible cause and details steps to take to resolve.
http://msdn.microsoft.com/en-us/library/ms235342(VS.80).aspx
0
 
LVL 40

Expert Comment

by:evilrix
ID: 33645594
BTW: you are trying to run this on the development machine, right? I mean the debug version of the CRT won't exist unless you have Visual Studio installed! You should be able to locate the specific CRT for your version of Visual Studio by checking in the following folder...

%PROGRAMFILES%\Microsoft Visual Studio 8.0\VC\redist\Debug_NonRedist\x86

Try coping the contained dlls into the same run folder as the executable. If it then works (cos it will check its own run folder when looking for the DLLs it needs) the issue is definitely that the DLLs are not installed correctly.
0
 

Author Comment

by:Smanyx
ID: 33651470
>> Have you checked that it is on your machine, in the correct search path to load a DLL and that it is >>version 8.0.50727.4053?

From the manifest file, I can see that the version I've got is rather 8.0.50608.0

Reading info in the link you provided: http://msdn.microsoft.com/en-us/library/ms235342(VS.80).aspx, it says:

>> For example, Visual Studio 2005 installs the CRT assembly as a shared side-by-side assembly >>which can be found in the directory %WINDIR%>>\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50608.0_x-ww_b7acac55 when running >>Windows XP

I looked in the specified directory, and could not find x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50608.0_x-ww_b7acac55

But rather a bunch of

x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd
x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700
x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1833_x-ww_5ef082d6
x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.3053_x-ww_b80fa8ca
x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4027_x-ww_e69378d0
x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989

>> You should be able to locate the specific CRT for your version of Visual Studio by checking in the >>following folder...
>>%PROGRAMFILES%\Microsoft Visual Studio 8.0\VC\redist\Debug_NonRedist\x86
>>Try coping the contained dlls into the same run folder as the executable.

I have copied the .dlls found in the specified directory:
Microsoft.VC80.DebugCRT.manifest
msvcm80d.dll  (80.50727.42)
msvcp80d.dll  (80.50727.42)
msvcr80d.dll   (80.50727.42)
In the run directory of the project (i.e the debug folder), still no success.

>> BTW: you are trying to run this on the development machine, right? I
Yes, the very same machine I have vs2005 installed and where I run any other apps I write.

 

0
 
LVL 40

Expert Comment

by:evilrix
ID: 33651615
Hmmm. Well there is another solution... just download a newer version of Visual Studio :)
http://www.microsoft.com/express/Downloads/

Ok, not really a solution but at least it'll get you working.
0
 

Author Comment

by:Smanyx
ID: 33652341
>> Ok, not really a solution but at least it'll get you working.

I' ve tried the same code, on the same machine, using vs2008 EE. It is running perfect.
I don't know...does it give any clue?
Is there a way to repair, if repair is needed, the version of vs2005 I have.
I mean, it doesn't make sense to me. All the code I write using this version do run without any problem except those related to using the boost libraries. What can I conclude?
Well, I am lucky that there are other version of vs available out there, but what if there were none? What could I have done then? I am just trying to go to the bottom of the problem and have a grasp of what happened, how to fix it, rather than just a workaround(not that I don't appreciate having the workaround though...)

Thanks.
0
 
LVL 40

Accepted Solution

by:
evilrix earned 400 total points
ID: 33652780
Ok, I connected to work via my VPN and tried the code you posted and it worked exactly as one would expect. For me this is conclusive proof that the issue is your development machine and not the code you are trying to run.

At this point I can only suggest you completely uninstall VS2005 and then try reinstalling it plus the service pack. It seems something about your install is either incomplete or corrupt. This was exactly the case the one and only time I had this issue but I resolved it as I explained above.
0
 

Author Comment

by:Smanyx
ID: 33652826
Ok. I'll try to uninstall and re-install vs2005 on my machine. Hopefully, I won't have this issue again.
Thanks for all your input.

 
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now