Programming :: "use Of Enum 'Eitem' Without Previsous Declaration"and"Eitem Does Not Name A Type"?
Jan 24, 2010Code:
enum Eitem = {XCAM,YCAM,ZCAM,
XCEN,YCEN,ZCEN,
[code]....
Code:
enum Eitem = {XCAM,YCAM,ZCAM,
XCEN,YCEN,ZCEN,
[code]....
Code:
DWORD type = REG_NONE;
int i = 0;
[code]....
I've got an enum in the global scope in my file.c. If I try to reference that enum in a function, I get an error:
Code:
// declared in the public scope:
public enum AMFFlags { AMF_AMF3 = 1<<0, AMF_BIGENDIAN=1<<1,AMF_ASSOC=1<<2,AMF_POST_DECODE = 1<<3,AMF_AS_STRING_BUILDER = 1<<4, AMF_TRANSLATE_CHARSET = 1<<5,AMF_TRANSLATE_CHARSET_FAST = 1<<5|1<<6};
// the function, declared via macro:
PHP_MINIT_FUNCTION(amf)
[Code]...
the compiler (g++ 4.4.5) does not recognize PRE as a type in the following code:
Code:
enum mode {PRE, IN, POST};
class tree
[code]...
I'm trying to compile a program and it gives me the following:
I checked cmath-util.h:46 and cmath-util.h:48:
I'm not a C person, and the author is unavailable so far.
I am trying to generic way to convert the string datatype to other primitive data type. To achieve, i used Template . But i getting error and couldn't resolve the issue and error reported is also clueless.
Code
====
#include <vector>
#include <iostream>
#include <string>
[Code].....
I create a MySQL table with a ENUM column with the possible values BOOK, DVD, and CASSETTE. And then two years later I decide I want to add another possible value (say, ISOLINEAR CHIP :-). This won't be a problem, right? I got the impression from an on-line post that I could use ALTER TABLE to do this and it wouldn't be a problem. But I wanted to get a second opinion because obviously I don't want to come back two years later and run into some major issue.
View 1 Replies View RelatedIn C++ what does the suffix, "*" mean appended to a variable type, e.g., "char* variable1;"?
View 3 Replies View RelatedI have included fstream in my file (#include <fstream>) In the file, I have a class declaration and a private variable static fstream fileStopWatch; Then I am getting the error "'fstream' does not name a type" It was working in gcc version 4.1.2 20080704 (Red Hat 4.1.2-48) but not working in gcc version 4.4.4 (GCC)
[Code].....
I declared a variable as int data type which was a placeholder for a resulttatus (meaning, based on the result status that variable varies from 0/1/2/3. It can contain only these four values).data type is 4 byte integer in C#. But I can declare this variable as which represents a 1 byte integer. Since that variable contains only 1 or 2 or 3 or 4, declaring the variable asis wastage of memory space.Before declaring any variable we need to just think of the memory space needed for that variable, our requirement,
View 6 Replies View RelatedI'm quite new to c++ programming, so my concepts are not so increased yet...
I wanna to create a list to store my objects. I'll resume them here:
Code:
private:
And what I want to do is an event list:
Code:
Sometimes this works and sometimes I got "segmentation fault".
I think I'm doing it wrong, cause these objects have different sizes, so I don't know if I could have all of them in a single array.
I have a C header file which have arrays of predefined(known) structure type. But i dont have names of arrays and their size. when i include that file and compile my application, i want to know the names and sizesof those arrays.
purpose of application is to get the content of those arrays and to explain it in descriptive words instead of hex numbers.ofcourse this can be done by file pointers and reading also with out header file inclusion, but as i am working in C, once compiled, those variables are in my address space in i include header file.
i m doing a program to open a file, however, there is error saying that 'File' undeclared. but I thought File is a type like int or char, isnt it? below is my codes:
Code:
#include "mpi.h"
#include <stdio.h>
#include <math.h>
[code]...
i have been make the statement with error in red color.
I am trying to learn how to use true type fonts in SDL using libsdl-ttf. I am trying to use the font "FreeSans.ttf" but my program prints out the message "Couldn't open FreeSans.ttf." Any way to get a list of what fonts true type fonts exist using C++ and SDL?
View 2 Replies View Relatedubuntu terminal mingling made me want to learn programming, i started with python, using idle workspace (is this the right term?)i got to the stage when i need and want to use SPE workspace.i have downloaded it, but can't type in it - when i type, nothing happens at all.where have i been wrong please ?
View 3 Replies View Relatedin c/c++, double is usually 8 bytes. It has a 52-bit mantissa (or significand, or base), an 11-bit exponent, and a 1-bit sign. My question is: is the mantissa a 52-bit integer? Or is the decimal point just after the first bit. Meaning: if the mantissa was 1000110011100011 (in binary) would that make the value of the mantissa (assuming the exponent was 0) 1000110011100011, or 1.000110011100011? (in binary)
View 1 Replies View RelatedI am fairly new to c++. There must be a better way to do the following?:- Say I have a base class, Pet. I have several child classes that extend from this, like Dog, Cat, Fish etc.
I have the following function, that returns a pointer to a new Pet:-
Code: Pet* addPetToVet()
{ //Do some stuff
return new Pet();
} This will return a pointer an instance of a pet object.
Now, if I want to interpret this pet as a dog or cat I have to do this:-
Code: Dog* dogA = static_cast<Dog*>(addPetToVet());
Cat* catA = static_cast<Cat*>(addPetToVet()); Is there a way around this? Casting seems lame. I cant write a function for each type of pet.
I'm a C / assembler programmer so am not use to C++, which I need to use. Basically I'm using my own versions of memcpy, but for long and int rather than char. It's for fast graphics. So I have a char array which I copy to another array. But I copy as either longs or ints, much faster. for example
Code:
void * fastmemcpysprite (void *destaddr, void const *srcaddr, size_t len)
{
[code]...
I need a data type to hold TetraByte.Even I want to know details of int64, long, unsigned long long, and how they differ from each other.
View 14 Replies View RelatedI'm sure this has been covered somewhere before, but I couldn't find anything and so figured I would post here. I have been using Linux OSes for the past couple of years and also using GCC/G++ for application development. However, I have almost always been on x86 systems and never gained much experience using the wide range of optimization options available.
My question is, if I do not specify the -march=PROCTYPE option, will GCC still be able to detect the current architecture and build the code accordingly? I primarily ask this because I am working with an x86_64 system, and specifying -march=x86_64 in my makefiles generates errors about it being an unknown processor type, even though the CPU and OS are X86_64. I know this sounds like a newbie question, but it's just ground I've never had to cover before until now.
I need to launch programs in my program and the program can be a script, a Linux executable or even a Windows executable. The first thing i tried is to use xdg-open from my program, but i can't pass arguments to it, otherwise it would have worked perfectly. Is there maybe a way to determine which program is set as default according to the mime-type of the program i want to launch? I also tried kfmclient and gnome-open, they don't allow arguments either.
View 2 Replies View Relatedmisunderstood structure definition at the beginning
View 3 Replies View RelatedI'm a n00b to both numpy and python. I was wondering what the most intelligent way to write the trapezoid rule function was:
Code:
>>> import numpy as np
>>> a=np.array([1,2,3,4,5])
>>> def mytrapz(vec):
total=0
for i in xrange(0,len(vec)-1):
total+=(vec[i]+vec[i+1])/2.0
return total
>>> mytrapz(a)12.0 This is exactly what I would do in C and I'm sure the for loop is not the fastest way (as is the case for my interpreted langs). Yes, I know there is already numpy.mytrapz... I'm interested in the most efficient way to loop over arrays in such a way that each iteration accesses more than one cell.
I have a problem - I have files with rows of data and I need to check if the next row (of the same type) has the NEXT date in it so I need to extract a date in YYYYMMDD format from a row (easy enough) then add one day to it and compare it to the the next date I encounter on a subsequent row.
So if I have
DATE|20100530
VAL|kahskjhd
[code]...
I have a vector of bytes that I need to store in a DB2 database and was wanting to do it with a column declared as VARCHAR () FOR BIT DATA. I can do this with no problem except when a byte representing the NULL character occurs in the vector. Anytime this occurs, the rest of the bytes are truncated. I know this is the proper behavior for if this were a string, but I was under the impression that if the column is declared as I previously mentioned, that this would support any variable length binary data including the NULL character.
I've found repeated references to people dealing with DB2 tables where the data in VARCHAR columns contained leading and embedded NULLS, so I know this is possible. Can anyone provide me with the proper INSERT statement in order to get this to work? This is the current BindParameters call I'm making for the VARCHAR () FOR BIT DATA column that's truncating after the NULL character occurs.
Code:
SQLBindParameter(handleStmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR,
SQL_VARCHAR, (SQLUINTEGER)(30000), 0, data2, 30000,
&sqlNts);
The first line of this struct:
Code:
struct custom_int {
typedef int big_int;
[code]...
I'm working with Radiotap headers right now. I want to get the RSSI data. I came through a problem that I can't figure out right now.The value that I need to get is:
Code:
s8 IEEE80211_RADIOTAP_DBM_ANTSIGNAL
now, when I printf it:
[code]...
how to convert a dictionary data-type to a string?
actually I am trying to update some json file 's dictionary.
Does anyoe have any example c/c++ code that is used to parse type-length-value messages.
The only decent article I can find on the web is:
http://en.wikipedia.org/wiki/Type-length-value
Bur it does not give any examples of parsing etc..
when i compile the device driver of led ,i get the erro like this:
[root@localhost led]# arm-linux-gcc -D__KERNEL__ -DMODULE -I /home/liumeng/lmldd
/linux-2.6.34.1/ -c -O -Wall led.c -o led.o
led.c:34: error: variable `GPIO_LED_ctl_ops' has initializer but incomplete type
[code]....