UnUnderstandable typedef -- for me :-)

O

Olivier

Dear all,

while reading lpsolve, part lp_types.h, I stumbled on
the lines :
---------------------------------------
typedef struct _lprec lprec;
typedef struct _INVrec INVrec;
union QSORTrec;
---------------------------------------
which I don't understand at all ---

More pragmatically, I'm trying to compile a programm
with two libraries : lpsolve asks for st99, while
pari asks for st89. I'm trying to use:

gcc -Wall -pedantic BTRSP.c -o BTRSP -std=gnu99 -lm -llpsolve55
-I/usr/local/share/lp_solve/ -lpari

but I get an error "BTRSP.c:204: error: 'lp' undeclared",

where of course, lp is a pointer on lprec.
I can't seem to be able to find where this lprec is defined.

Any pointer would be appreciated!!
Best,
Amities,
Olivier
 
G

Guest

Olivier said:
Dear all,

while reading lpsolve, part lp_types.h, I stumbled on
the lines :

It defines the types lprec and INVrec as shorthand for struct _lprec
and struct _INVrec. The members of these structures are defined
elsewhere.
More pragmatically, I'm trying to compile a programm
with two libraries : lpsolve asks for st99, while
pari asks for st89. I'm trying to use:

gcc -Wall -pedantic BTRSP.c -o BTRSP -std=gnu99 -lm -llpsolve55
-I/usr/local/share/lp_solve/ -lpari

but I get an error "BTRSP.c:204: error: 'lp' undeclared",

where of course, lp is a pointer on lprec.

No, it's not. Your compiler is telling you lp is not declared. If it's
not declared, it can't be a pointer to anything.
I can't seem to be able to find where this lprec is defined.

In lp_types.h, according to your quoted code.
 
O

Olivier

Hi,
It defines the types lprec and INVrec as shorthand for struct _lprec
and struct _INVrec. The members of these structures are defined
elsewhere.

Ok,then I should be able to find a definition somewhere --
[...]
No, it's not. Your compiler is telling you lp is not declared. If it's
not declared, it can't be a pointer to anything.

Ok, maybe I should have been more precise.
The line incriminated is (from my own file)
--------------------------
lprec *lp;
--------------------------

Found the definition of _lprec !! ---
This one is in lp_lib while lprec is a shortcut defined in lp_types
Anway, I included lp_types.h in case :-(

I tried
--------------------------
_lprec *lp;
--------------------------
but this time _lprec is not recognized --


I'll continue later, but if you have some pointer in between,
I'll be most happy :)
Amities,
Olivier
 
A

Army1987

Olivier said:
Hi,
It defines the types lprec and INVrec as shorthand for struct _lprec
and struct _INVrec. The members of these structures are defined
elsewhere.

Ok,then I should be able to find a definition somewhere --
[...]
No, it's not. Your compiler is telling you lp is not declared. If it's
not declared, it can't be a pointer to anything.

Ok, maybe I should have been more precise.
The line incriminated is (from my own file)
--------------------------
lprec *lp;
--------------------------

Found the definition of _lprec !! ---
This one is in lp_lib while lprec is a shortcut defined in lp_types
Anway, I included lp_types.h in case :-(

I tried
Check out www.c-faq.com, question 2.2.
 
G

Guest

Olivier said:
Hi,
It defines the types lprec and INVrec as shorthand for struct _lprec
and struct _INVrec. The members of these structures are defined
elsewhere.

Ok,then I should be able to find a definition somewhere --
[...]
No, it's not. Your compiler is telling you lp is not declared. If it's
not declared, it can't be a pointer to anything.

Ok, maybe I should have been more precise.
The line incriminated is (from my own file)

If your compiler is telling you that lp is not declared on that line,
it means it's not reading "lprec" as starting a declaration. Possibly
lprec is not defined (because you forgot the proper #include?).
Possibly lprec is defined, but not as a type (because you have a local
variable with the same name)? Otherwise, maybe the line is in a
location where a declaration is not allowed? You really haven't given
a lot of details.
 
O

Olivier

Army1987 wrote:

thanks and yes, I misread the first answers that said clearly that
'lprec' is a shorhand for 'struct _lprec' and not for '_lprec' :-(
A.O.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top