Hi all.
Here I am again with some basic questions:
— Creating a button. I want to dinamically create a button. In the text of
the button I want to show the value of an integer variable. The fragment of
code is:
<…>
n = 0;
value = 3;
PtSetArg(&args[n++], Pt_ARG_TEXT_STRING, (char )value, 0); / here
the program crashes */
PtCreateWidget(PtButton, window, n, args);
<…>
When I execute this code the program crashes. The problem here is how to
fill the third parameter of the PtSetArg function,
because if I set this parameter with a constant value, for example:
PtSetArg(&args[n++], Pt_ARG_TEXT_STRING, “ButtonText”, 0);
… then it works fine and the button successfully appears. I’ve tried
with (char) and (uchar_t *), with no success.
More problems with the PtSetArg function: In order to set up the top-left
corner of the button I’ve tried the following code:
<…>
PhPoint_t p;
p.x = 20;
p.y = 20;
PtSetArg(&args[n++], Pt_ARG_ORIGIN, p, 0); /* problems! */
<…>
The compiler answers:
…/Obre.cc:73: struct PhPoint_t' used where a
long int’ was expected
Any ideas??
— Making the executable. In my project I use a C++ class. In order to
include my files in the project I’ve tried two approaches:
- Modifying files ‘indOfiles’, ‘indHfiles’ and ‘indSfiles’ (adding my
class.o, class.h and class.cc, respectively). Then the make process stops
with error:
qcc -Vgcc_ntox86 -w5 -O -O3 -fomit-frame-pointer -I. -c -o abmain.o
…/abmain.cc
In file included from …/abmain.cc:37:
proto.h:8: syntax error before ::' <---- Cclass ::Cclass ( void ); proto.h:9: syntax error before
::’ <---- Cclass ::~Cclass
( void );
proto.h:10: syntax error before ::' <---- void Cclass ::method_a int i ); proto.h:11: syntax error before
::’ <---- int Cclass ::method_b
void );
cc: /usr/lib/gcc-lib/ntox86/2.95.2/cc1plus error 33
make[1]: *** [abmain.o] Error 1
make[1]: Leaving directory `/root/provacpp/src/gcc_ntox86’
make: *** [shr] Error 2
As you can see, something’s wrong here with the proto.h generated…
- Modifying the files ‘abOfiles’, ‘abHfiles’ and ‘abSfiles’ (adding my
class.o, class.h and class.cpp, respectively). It works fine, the make
command compiles my class.cpp and links the executable with my class.o. But
the problem is that this works UNTIL I generate again the project. After
that, the reference to my class in the ab*files disappears. I know that
these files shouldn’t be modified manually, but if approach 1) doesn’t
work… then I have no choice!! (Do I?)
Any ideas??
TIA
Jordi Garcia