Hi,
When using Microsoft Visual Studio, building in release the code just hangs and fails to execute but with Debug it builds and runs to the end. And I don't see why there should be a difference.

I did a shutdown then clean and a rebuild of solution but the behaviour persisted. I was wondering should there be any difference between the two versions or is this a sign that something else has gone wrong with my computer?


I am using classes that I use a lot, combined with a class I wrote tocombines two ordered vectors of strings each with an associated vector of ints.

In effect I am trying to merge two map<string, int> into one. The sizes move upto around 100000 elements

I am doing this with iterators, push_back and insert

other possibly pertinent facts:
- it compiled and built the release solution once today with code that should not have compiled as I had a bool function with no return.
- I am using absolute file locations on the same pc
- I had a crash earlier in release when the debugger complained of being unable to attach hook process.
- I am running XP and there is a virus circulating uni computers but I am unsure if my computer has been exposed
- I am processing a large number of files on my D: there is around 140Gb of 200Gb currently in use in about 15,000,000 files


Any thoughts as to what might explain this behaviour would be appreciated - or any advice that should ensure everything is reset properly.

Thanks

Is your code using assert() or any of the VS macros wrapped around assert() ?
Furthermore, have you written e.g.

#ifdef _DEBUG
.. do something here ..
#endif

If you have, then make absolutely sure that you are not changing anything via those pieces of code.

It was a good thought, but the only code guard that I am using
is #pragma once I doubled checked my code and I am not using assert

It is console based appliction

and the only code that I am including in the project that is not self written is
<vector>, <string>, <iostream>, <map>

I will try a more rigourous approach by deleting the entire folder directly, then rebuild, but I can't do that for probably 1/2 an hour as I am in the middle of a slow Debug run:(


Is your code using assert() or any of the VS macros wrapped around assert() ?
Furthermore, have you written e.g.

#ifdef _DEBUG
.. do something here ..
#endif

If you have, then make absolutely sure that you are not changing anything via those pieces of code.

Delteted Release folder and .ncb

and still it does not run.

It was worse than I though I had forgotten that the first line of
the main is a

#include <iostream>
/*
several other includes
*/

int main
{
std::cout << "wiki test" << std::endl;

/*
lots of other code
*/
return 0
}

there are no statc members, functions,
no globals
It does not even show the first line before hanging.

I left out <fstream> earlier as an include file in the project


THe above cout will build in an entirely new project int release

But I have run out of ideas.:confused:

Hmm, main is without parenthesis there, so I assume that you just typed that piece of code as an example, instead of copying it from the program's code.

Increase the warning level to the highest (W4) and rebuild the project. What does the compiler say?

I get quite a ew warnings around 76

most of which are non referenced variables or
passing a function return to a

(std::string & )

with treat warning as error I get a
object not created error thay I assume is just because there is a warning.

I rebuilt in a new solution and everything runs :) so clearly there has been a corruption not directly caused by the code :(

The only things that I can think of are:

a dll is somehow attached to the process even though the files were deleted

the MFT has been screwed up so the release version is finding a non-current folder

a corruption in Visio

My concern is that if any of these things has happened the code might well be behaving unpredictably and I need to use the results.

Thanks again for the help.

Hmm, main is without parenthesis there, so I assume that you just typed that piece of code as an example, instead of copying it from the program's code.

Increase the warning level to the highest (W4) and rebuild the project. What does the compiler say?

yes typo leaving off ()

>>I get quite a ew warnings around 76 ..
Choice to ignore warnings is all yours (I hope you do know what you are doing though).

I'd would assume some sort of VS failure, in terms of building a proper binary, but then again who knows.

Just my two cents, but I wouldn't just accept that it was Visual Studios fault unless you're 100% sure. Errors, in my experience, don't usually just disappear.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.