Declaration for an object? [Solved]

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

Declaration for an object? [Solved]

#1 Post by tasmod »

EDIT: See next post.

Trust that is correct title?

I've reached the point where a compiling error is now referencing an .h custom library which has me baffled for now. I'm not familiar yet with what is happening with the error messages in the compiler regarding a library.
Anyway here's a contracted description.

Instructions with the library are to add a line to the 'int main' function thus:

Code: Select all

  psession* mysession;
where mysession is an object(?)

There is a struct in the library:

Code: Select all

typedef struct { blah blah blah } psession;

Now, I have a function that uses mysession so I figured that the psession* mysession should be in that function (all examples supplied with the library use 'main')

That threw up an error during compiling about undefined references in the library.
Putting it back in 'main' then only threw up one error, 'mysession' undeclared, in my code 'function'.

Now, I'm not sure how to declare it. I've tried finding help references through the 'net regarding

Code: Select all

 blah* blah2
shall we say,but I have had no joy.

None of the examples supplied with the library use anything but a code sample using 'int main' only.
There are executables of each example and the corresponding .c file to go with it.

Interestingly trying to compile an example .c file threw up just such a first error regarding undefined referencing to the library call functions (i.e. functions in library, not in the code)???
Yet the example executables work?

Anyone any ideas from this cryptic clue puzzle?
Last edited by tasmod on Sat 14 Aug 2010, 13:47, edited 1 time in total.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#2 Post by tasmod »

Well a complete change.

Reading the one page text manual I realised the sample code line calling 'mysession' was different to the manual.

the manual had

Code: Select all

err = pbegin(vertoo, blutoo, lamp, psession** &mysession);
Where the sample code had ' psession** ' missing.

So, I inserted the ' psession** ' into my function err line and also added the line

Code: Select all

psession* mysession 
in my function instead of in 'int main'

Now it errors in compiler with the message " expected expression before psession** "
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#3 Post by tasmod »

OK, code is incorrect in manual but correct in examples.

popsession** is not needed in the line.

The rest of my compile errors are down to the compiler not recognising the lib? Or my ineptitude in using it!

This according to the helpful guys on the C forum.

Aren't compiler error messages so descriptive, NOT !!!
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#4 Post by tasmod »

OK for any readers interested. It was a compiling error. Although erroneous documentation doesn't help.

The library I intended to use had multiple compiling options at creation and I had chosen the wrong one. It left out of the library some of the functions I was calling. :oops:

Recompiled the library to suit and my app compiles without error.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

Post Reply