473,326 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

UnUnderstandable typedef -- for me :-)

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
May 12 '07 #1
5 1288
Olivier wrote:
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 ---
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.

May 12 '07 #2
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;
--------------------------
>I can't seem to be able to find where this lprec is defined.
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
May 12 '07 #3

"Olivier" <Ol**@nowhere.wdha scritto nel messaggio
news:46**********************@news.free.fr...
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;
--------------------------
>>I can't seem to be able to find where this lprec is defined.

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 --
Check out www.c-faq.com, question 2.2.
May 12 '07 #4
Olivier wrote:
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;
--------------------------
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.

May 12 '07 #5
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.
May 12 '07 #6

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

Similar topics

2
by: joe | last post by:
hi, after reading some articles and faq, i want to clarify myself what's correct(conform to standard) and what's not? or what should be correct but it isn't simply because compilers don't...
4
by: Chris | last post by:
I've lurked around long enough... Time to interract =) I'm trying to make sense of the following. I can't quite wrap my head around what this is actually doing: ------------- typedef enum {...
15
by: Merrill & Michele | last post by:
typedef struct { WORD versionNumber; WORD offset; } MENUITEMTEMPLATEHEADER; This is from vol 5 of unnamed platform's programmer's reference. I could make this conforming by enclosing...
16
by: burn | last post by:
Hello, i am writing a program under linux in c and compile my code with make and gcc. Now i have 4 files: init.c/h and packets.c/h. Each header-file contains some: init.h: struct xyz {
12
by: vvv | last post by:
Hi All, Do we have anything in .NET which is equivalent to C++'s Typedef . Regards, Vasanth
6
by: Alex | last post by:
Hello people, I am getting errors from VS2003 when working with typedef'ed types. For example, assume that I have a type T, defined in a 3rd party include file based on some condition #if...
15
by: Ian Bush | last post by:
Hi All, I'm a bit confused by the following which is causing one of our user's codes fail in compilation: typedef struct SctpDest_S; 1) Is this standard ? 2) If so ( or even if not so ! )...
12
by: Googy | last post by:
Hi!! Can any one explain me the meaning of following notations clearly : 1. typedef char(*(*frpapfrc()))(); frpapfrc f; 2. typedef int (*(arr2d_ptr)()); arr2d_ptr p; 3. typedef int...
16
by: mdh | last post by:
A quick ? :-) question about Typedefs. There is a very brief discussion about this in K&R ( p146). Googling this group, there is a surprising dearth of questions about these. From one of the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.