views:

61

answers:

2

Hi,

There was a program what I could compile under 2008 for a while. Note I can compile the program using cl and in Ultimate++ IDE. It is a fairly large program , so I am not going to post it here. I cannot compile it in Studio.

THere error is 1>c:\program files\microsoft visual studio 9.0\vc\include\xstring(1735) : error C2856: #pragma hdrstop cannot be inside an #if block

which seems to be idiotic as there is no hdrstop in there.

Precompiled headers are turned off.

   This is what is there:
            if (_Mysize < _Off)
                _String_base::_Xran();  // _Off off end
            if (_Mysize - _Off < _Count)
                _Count = _Mysize - _Off;
            _Traits_helper::copy_s<_Traits>(_Dest, _Dest_size, _Myptr() + _Off, _Count);
            return (_Count);
            }

        void __CLR_OR_THIS_CALL swap(_Myt& _Right)
            {   // exchange contents with _Right <<<<<<<<----------this is the line 
            if (this == &_Right)
                ;   // same object, do nothing
            else if (_Mybase::_Alval == _Right._Alval)
                {   // same allocator, swap control information

Thanks.

A: 

Because Visual C++ invokes cl (which works fine) and you obviously have messed up headers, the first thing I'd check are include paths. Post them here.

EFraim
I checked them, they(the studio headers) were a little bit different from the headers in the command line version. Even if I make them the same, the problem persists.
Aftershock
How could I mess up the header which causes some a weird error?
Aftershock
What include paths? List of includes that include xstring.h or the other one?
Aftershock
+1  A: 

Wild guess.

The precompiled headers are switched off for the project? Are they switched off for every single source file in the project (cause individual file settings overwrite whole-project settings).

ygrek
yes, it was not turned off for one file and it was part of the problem.
Aftershock
Also, I experimented X64 code generation which may be related to it.
Aftershock