Link to home
Start Free TrialLog in
Avatar of rwinkler
rwinkler

asked on

compiles in one place, not in another

I've downloaded an opensource library (pwlib from voxgratia.org, in case you're curious).  It's a little complicated to get compiling, but I eventually got it working.  Now, I'm trying to build a library of my own (in Visual Studio .NET) using this library.  When I try to compile my library, I get a compile error caused in pwlib.  Actually, I get a lot of compile errors.  Typical "I can't figure out what this object is" sort of compiler errors (not linker errors, at not least yet).  I've set the following under Librarian->General->Additional Dependencies:
openh323d.lib ptlibd.lib ptclibd.lib ptlibsd.lib

Any suggestions?
Avatar of nonubik
nonubik

>I've set the following under Librarian->General->Additional Dependencies:
>openh323d.lib ptlibd.lib ptclibd.lib ptlibsd.lib

This is the linking part. You're getting compiling errors (which is before linking).
It seems that you need to include some headers in order to "figure out what this object is". Please post some compile errors to get more help.
Avatar of rwinkler

ASKER

Although you are correct that this seems to be a compile error, I can move my C++ class into one of the sample projects provided with the openh323 library (which is why I'm using pwlib... openh323 needs it) and it compiles just fine.  In fact, my class is just a modification of one provided in the openh323 samples.

I don't have the exact errors in front of me at the moment (I'm at home at the moment), but the first one was something to the effect of:
PObject unrecognized class

If you really think it would help, I'll post part of the compile error list, but I'm skeptical that it will be useful.
If you are so skeptical, maybe it just need some 'Additional Include directories' to be set in the settings, maybe the wrong headers with the same name are included.
But this would raise "could not open xxx.h file" error....
I thought that may have had merit, but the additional include directories are both the same (completely empty).  All those college courses on programming, but not one even offered on how to get IDE's to do what you want.  Bah.
Still, by posting the errors, you may get more help..
There's more where this came from, but here's about the first fifth of the output (it maxes out after about 100 errors):
c:\dev\pwlib\include\ptclib\dtmf.h(34) : error C2504: 'PObject' : base class undefined
c:\dev\pwlib\include\ptclib\dtmf.h(35) : error C2061: syntax error : identifier 'PObject'
c:\dev\pwlib\include\ptclib\dtmf.h(37) : error C2143: syntax error : missing ';' before 'public'
c:\dev\pwlib\include\ptclib\dtmf.h(37) : warning C4183: 'PCLASSINFO': missing return type; assumed to be a member function returning 'int'
c:\dev\pwlib\include\ptclib\dtmf.h(39) : error C2146: syntax error : missing ';' before identifier 'Decode'
c:\dev\pwlib\include\ptclib\dtmf.h(39) : error C2501: 'PDTMFDecoder::PString' : missing storage-class or type specifiers
c:\dev\pwlib\include\ptclib\dtmf.h(39) : error C2061: syntax error : identifier 'PINDEX'
c:\dev\pwlib\include\ptclib\dtmf.h(39) : warning C4183: 'Decode': missing return type; assumed to be a member function returning 'int'
c:\dev\pwlib\include\ptlib\semaphor.h(126) : error C2226: syntax error : unexpected type 'BOOL'
c:\dev\pwlib\include\ptlib\semaphor.h(126) : error C2238: unexpected token(s) preceding ';'
c:\dev\pwlib\include\ptlib\semaphor.h(137) : error C2143: syntax error : missing ';' before '&'
c:\dev\pwlib\include\ptlib\semaphor.h(137) : error C2501: 'PWaitAndSignal::PSemaphore' : missing storage-class or type specifiers
c:\dev\pwlib\include\ptlib\semaphor.h(137) : error C2501: 'PWaitAndSignal::semaphore' : missing storage-class or type specifiers
c:\dev\pwlib\include\ptlib\semaphor.h(175) : error C2504: 'PObject' : base class undefined
c:\dev\pwlib\include\ptlib\semaphor.h(176) : error C2061: syntax error : identifier 'PObject'
c:\dev\pwlib\include\ptlib\semaphor.h(176) : warning C4183: 'PCLASSINFO': missing return type; assumed to be a member function returning 'int'
c:\dev\pwlib\include\ptlib\semaphor.h(214) : error C2143: syntax error : missing ',' before '&'
c:\dev\pwlib\include\ptlib\mutex.h(99) : warning C4183: 'PCLASSINFO': missing return type; assumed to be a member function returning 'int'
c:\dev\pwlib\include\ptlib\channel.h(191) : error C2504: 'streambuf' : base class undefined
ASKER CERTIFIED SOLUTION
Avatar of nonubik
nonubik

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is where I was saying, it compiles fine by itself.  And in all the sample projects.  Then again, I don't compile all of the pwlib projects to build the libs (as per the instructions) and some of the others don't actually compile.  I figured they weren't important for the usage of pwlib.  Maybe that's where the problem lies.  It's only when I create a new project and try to use the library (and, apparently, something that doesn't) that I get this error.  Modifying the library ~shouldn't~ be the solution.  Especially since it compiles fine in other projects.  

On the other hand, I posted to the openh323 newsgroup, and they said the same thing.  It worked.  I guess I should have given that a try before posting.  Ah, the complexities of it all.  I hope they fix that in the next source dist.  Thanks for the help.

in case someone finds this solution useful, this is the include necessary:
#include <ptlib.h>