Hi all, (yet another) problem saw it fit to grace me with its presence...
I'm trying to use the bitset container, but somehow I must be using the wrong libraries, for I get an undeclared identifier compiler error when trying to compile the following code;
#include "filter.hpp"
//more stuff
void getVGFz(char *buffer, long linecount){
//yet more stuff
char VGbuffer[] = "0101";
std::bitset<4> VGbits(string(VGbuffer));
long value = VGbits.to_ulong();
}
I get the error 'string' undeclared (first use this function)
on line 9 of the second code excerpt. Am I using 'string' in a bad way here (I looked at the bitset entry in the site's documentation)? I have the feeling I need to initialize VGbuffer not as an array of type char but as an object of type string.
Edit: But why does it tell my that VGbits is of non-class type and refuse compiling? I know it is of non-class type, I instatiated an object VGbits of the type bitset, did I not? I think I used a direct adaptation of the example on the site.
In function 'void dosomething()':
request for member 'to_ulong' in 'bits', which is of non-class type 'std::bitset<4u>()(std::string)'
[Build Error] [main.o] Error 1
(Using Dev-C++ 4.9.9.2)
I don't mean to be a blockhead, but I just can't see what I'm doing wrong.
Well, I'm home from work now (trainee... though why they assigned me to a C++ programming task, I do not know, I suck at it, obviously) and won't be back there until monday, but trying to compile it on my mac (gcc 4.0.1) caused a whole slew of errors to crop up, some examples:
Undefined symbols:
"std::basic_ostream<char, std::char_traits<char> >::operator<<(unsigned long)", referenced from:
dosomething() in ccrWe5hQ.o
"___gxx_personality_v0", referenced from:
___gxx_personality_v0$non_lazy_ptr in ccrWe5hQ.o
"std::allocator<char>::allocator()", referenced from:
dosomething() in ccrWe5hQ.o
"std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)", referenced from:
__ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_$non_lazy_ptr in ccrWe5hQ.o
It all looks a bit strange to me, but maybe switching from Win XP to Mac OS X is the problem.