473,700 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BitArray use (System.Collect ions)

I was so happy to find the BitArray class.

Until I 'cut and pasted' the following sample code from Visual Studio's help:

#using <mscorlib.dll >
#using <system.dll>

using namespace System;
using namespace System::Collect ions;

I got the following error repeated 4 times:

fatal error C1190: managed targeted code requires '#using <mscorlib.dll >'
and '/clr' option

Sorry if this is a 'newbie' question, but has anyone seen this before and
know what to do? Can I buy a vowel? Is Visual Studio telling me I have to
build my OS dll's with the '/clr' option for heaven's sake?! Obviously I
can't do that.
Feb 9 '06 #1
7 2424
Guess I was brain dead today. I had the #using... in my '.h' file instead of
my '.cpp' file.

"Rick Williams" wrote:
I was so happy to find the BitArray class.

Until I 'cut and pasted' the following sample code from Visual Studio's help:

#using <mscorlib.dll >
#using <system.dll>

using namespace System;
using namespace System::Collect ions;

I got the following error repeated 4 times:

fatal error C1190: managed targeted code requires '#using <mscorlib.dll >'
and '/clr' option

Sorry if this is a 'newbie' question, but has anyone seen this before and
know what to do? Can I buy a vowel? Is Visual Studio telling me I have to
build my OS dll's with the '/clr' option for heaven's sake?! Obviously I
can't do that.

Feb 9 '06 #2
VS sample code below won't compile in my app:

#using <mscorlib.dll >
#using <system.dll>

using namespace System;
using namespace System::Collect ions;

I get:

fatal error C1190: managed targeted code requires '#using <mscorlib.dll >'
and '/clr' option

Sad when the sample code won't even compile. I searched the help dox, my
project and options file for some clue about what was wrong. Nada.

Can anyone point me in the right direction? Thanks in advance.
Feb 10 '06 #3
I'm back to square one.

Put this sampe code in my app:

#using <mscorlib.dll >
#using <system.dll>

using namespace System;
using namespace System::Collect ions;

Got compile errors:

fatal error C1190: managed targeted code requires '#using <mscorlib.dll >'
and '/clr' option

Any ideas? It's awful when the sample code won't compile (nor give any
explanation where to look)
Feb 10 '06 #4
Maybe I'm on the path now that I've figure out "/clr" option means COMPILE
option. (MS you might've mentioned the word 'compile' in your error message,
considering the plethora of types of options there are in VS.)

Of course the "/clr" compile switch is not compatible with (I've yet to
determine how many) other compile switches. Thanks again MS for making me
find them one at a time. Sad!

I'm switching to Sun java.
Feb 10 '06 #5
Well, I'll be d*mn*d.

I got all the right compile, etc switches and tried again...AND IT STILL
WON'T COMPILE!

BitArray *smp = new BitArray(5);

generates error: "'Systems::Coll ections::BitArr ay': placement arguments not
allowed while creating instances of managed classes"

How f*ed up is that message? Could it be more cryptic or meaningless or
less helpful?! How pathetic. I'm beginning to remember why I quit using VS
for so long. Got tired of the frustration.

This has to be MS's way of marketing training (and generating the $99 a hit
per question income). They should just post a big banner on their splash
screen "Go ahead and try to use our arcane spaghetti IDE w/o our
training.....bw ahahaha <-evil laugh sound track".
Feb 10 '06 #6
Summary of my experience using the BitArray class in C++ from MSVS.NET:

#using <mscorlib.dll >
#using <system.dll>

using namespace System;
using namespace System::Collect ions;

will only work if compiler option "/clr" is present AND compiler options
"/z1", "/ctl1" and a few other are NOT present. They can be enabled/disabled
from the 'Project' menu under the 'Properties' choice (except of course for
/clr which I only found referenced in the arcane help section, but nowhere in
MSVS...fortunat ely it can be typed in manually). Sorry if I forgot a few of
the incompatible switches. You can find them...one at a time...by compiling,
getting a rebuke, removing the offender from the compile option list...and
repeat.

IN ADDITION:
"
// Creates and initializes several BitArrays.
BitArray* myBA1 = new BitArray( 5 );
"
(quote from the IDE sample code)

DOES NOT COMPILE. You get some arcane worthless message that is not at all
helpful. Also:

BitArray* myBA1;
myBA1 = new BitArray( 5 );

fails with the same error.

This compiles:

BitArray* myBA1;
myBA1->set_Length( 5);

but will SURELY fail at runtime...or will it?...as no memory was ever
allocated...or was it?!

WTF?
Feb 10 '06 #7
> IN ADDITION:
"
// Creates and initializes several BitArrays.
BitArray* myBA1 = new BitArray( 5 );
"
(quote from the IDE sample code)

DOES NOT COMPILE. You get some arcane worthless message that is not at
all
helpful. Also:

BitArray* myBA1;
myBA1 = new BitArray( 5 );

fails with the same error.

This compiles:

BitArray* myBA1;
myBA1->set_Length( 5);

but will SURELY fail at runtime...or will it?...as no memory was ever
allocated...or was it?!

WTF?


Ok, lets start at the beginning. In your first post you said you were
building OS dlls. I assume you are working on a personal OS. In which case
the CLR and the BitArray class are not ideal, since that is linked to the
CLR and I imagine implementing the whole of the CLR isn't high on your wish
list(that potentially means a huge number of classes, including BItArray,
along with a JIT, a GC, and so on. The Mono project might help, but thats
still alot of work). You'd do better to use pure C++ templates such as those
available in the boost project(www.boost.org,) assuming they fit your
licensing requirements.

Second, what version of Visual Studio(or Visual C++) are you using? There
are two different C++ dialects for managed code, MC++(or Managed Extensions
for C++) which has been available since VS2002(IIRC) and CLI/C++ which
debuted with VS2005. Both work different than standard C++ when working with
managed classes and will require a little learning to use properly. MC++
especially is a little tricky.
Feb 10 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4020
by: Ramzi Abboud | last post by:
I want to store a binary string in SqlServer from VB .NET through a stored procedure. I have been storing the binary data in a BitArray which I am not set on by any means. When I pass the BitArray into a stored procedure, which is looking for a variable of type binary, it throws the following: "Object must implement IConvertible." BitArray obviously does not implement IConvertable. If anyone has a good way of passing binary data into...
2
8936
by: Joel Moore | last post by:
Maybe I'm just easily baffled after an all-nighter but I can't seem to figure out how to represent a BitArray as a hexadecimal string. For example: Dim outputBank As New BitArray(8) outputBank(0) = True outputBank(1) = False outputBank(2) = False
1
5182
by: Marc Lefebvre | last post by:
How can I convert an Int to a BitArray ? Or How can I format an Int to a binairy string ? Thank's Marc Lefebvre
3
9916
by: Laszlo Szijarto | last post by:
In using the BitArray class to parse a single byte, I noticed that the bits show up in Little Endian order. Aren't bits always arranged in Big Endian order? I'm a bit confused and would appreciate any assistance. Thank you, Laszlo
7
7593
by: Eric | last post by:
Hi All, I need to XOR two same-length Strings against each other. I'm assuming that, in order to do so, I'll need to convert each String to a BitArray. Thus, my question is this: is there an easy way to convert a String to a BitArray (and back again)? I explained the ultimate goal (XORing two Strings) so that, if anyone has a better idea of how to go about this they may (hopefully) bring that up...?
0
1168
by: James | last post by:
Hi, I need to use an array of bitarray and being able to dinamically redim the bitarray and the array of bitarray. I need something like: structure stBarray public BA as bitarray() endstructure dim Array() as stBarray so I can:
3
2208
by: HKannen | last post by:
Hello Everybody, I wrote a little method that gets me an Int32 from a BitArray. This method looks like this: private Int32 GetIntVal( BitArray iArray ) { Byte lByteArr = new Byte; iArray.CopyTo( lByteArr, 0 );
4
3847
by: Rainer Queck | last post by:
Hi NG I have some questions concerning BitArrays. Assumption : BitArray with 16 Bits Is it possible to "load" a BitArray with a UInt16 Value with out iterating it like: UInt16 Bits = 0xAA55; for (int i = 0 ; i<16 ; i++){
2
2841
by: semedao | last post by:
Hi , I try the BitArray class to make Xor on 2 byte arrays. The result was that when I Xor 1with 2 I get 3 which is correct then Xoring 3 with 1 give me 0 (zero) when it should give me 2 ! but Xoring 3 with 2 give 2 which is correct... (should be 1) here is the sample code...
0
8712
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8639
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7794
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4649
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2375
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.