0

I have programmed an application in C++Builder 6, compiled in Windows 95, the application works perfectly.

The error appears when I compile the application on Windows 10. The following error occurs in the header file _bitset.h:

In

template <size_t _Nw>

On the line

_WordT _M_w[_Nw]; 

array must have at leas one element

Any ideas?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
neg1414
  • 25
  • 5
  • 3
    Please show a [mcve] – Jabberwocky Aug 12 '22 at 10:14
  • At a guess the array doesn't have at least one element. That would mean it has no elements. That would mean `_Nw` is `0`. Strict C++ does not permit zero length arrays. So whatever instantiation of that template is failing appears to be using zero size and that's not permitted. – Persixty Aug 12 '22 at 10:22
  • 1
    did you perhaps try to instantiate a bitset with `0` bits? – 463035818_is_not_an_ai Aug 12 '22 at 10:22
  • thanks for answering.. I understand that the error can be produced that the array is initialized to 0... What I don't understand is why it doesn't produce an error when compiling on windows95.. The error is not produced by something that I programmed... it is implicit when including the bitset class in the project and when compiling it in windows 10... It is possible that the error has to do with working at 64 bits or 32 bits... Thanks for answering.. forgive my english. – neg1414 Aug 12 '22 at 10:42
  • The upshot is that C++ Builder 6 doesn't support Windows 10 and if you want to you may have frig it. – Persixty Aug 12 '22 at 11:00
  • In the headers there'll be settings for various platforms and they aren't defined for Windows 10. That being much newer than that compiler. – Persixty Aug 12 '22 at 11:03
  • Please provide enough code so others can better understand or reproduce the problem. – Community Aug 12 '22 at 11:05
  • 2
    comments are not answers. The question cannot be answered unless you add more details – 463035818_is_not_an_ai Aug 12 '22 at 11:53

2 Answers2

1

Thank you all for answering...

I finally solved the problem...

Although the version of the class that I had installed on the new pc seemed the same as on the old pc the "boost_1_31_0" the _biset.h files were different, it was enough to replace the ones on the new pc with the old ones and EUREKA.

Thank you all for your time and excuse my English.

neg1414
  • 25
  • 5
0

Without MCVE source code or BCB6 installed on Win10 we can only guess sohere are few hints instead of direct answer...

First OS related hints:

There where quite a few changes in OS since BCB6 times. The most likely reason for problems are wrong absolute paths on 64bit windows simply copy compiler and IDE stuff from:

[Program Files (x86)]

into:

[Program Files]

that usually works for most of the older IDEs and SW build before 64bit Windows (like GC/GCC + Eclipse).

On top of this Win10 changed process scheduling to the point many older SW does not work properly or at all and even compatibility modes are useless in Win10. My experience with direct successor of BCB6 (BDS2006 Turbo C++ Explorer) is that to run properly you have to:

  1. run IDE as administrator

    You can set this in BCB6 icon properties (compatibility).

  2. set IDE process affinity to single CPU

    You can set this in Task manager on BCB6 process. Without this the IDE will freeze for few seconds (up to 45sec) every few minutes (or seconds).

    Beware if your app is multithreaded You have to set its affinity back to all CPUs somewhere in your App init code. This is done like this:

    Cache size estimation on your system?

    Just look for SetProcessAffinityMask usage in the last code there.

  3. install font fix for user folder

    I do not know if BCB6 needs this but BDS2006 will not work properly without it as after some Win7 update MS changed the policy of user folder and having fonts there is no longer allowed without fix.

If nothing works try to use Win7 there usually works everything on first try without any problems. Old developing tools tend to not work at all or properly on Win10 and newer versions are usually much worse than old some to the point of to be unusable especially for MCU and USB stuff. So its always a good idea to have a backup Win7 PC for development.

Now code related hints:

Different OS mean different compiler #define directives which means some parts of code might be different then on Win95 see:

so some (most likely inbuild) header files you use might be wanting to see some OS version and have numbers that are not handled in code properly causing some parts of code are not compiled. The remedy is simply to look for those #define in code and either change the version numbers or add new entries ...

Also it looks like BDS2006 compiler bug fix can remedy some weird bugs on BCB6 too so see:

Spektre
  • 49,595
  • 11
  • 110
  • 380