Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF

TOPIC:

error: Implicit conversion of C pointer type... 10 years 1 month ago #5605

  • starcutdec
  • starcutdec's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 2
  • Thank you received: 0
Hi,

I tried to follow the instructions in help_iOS_1.7.pdf to include PDFViewer 2.9.7 in my existing iOS 5 project.

When I try to compile I get an error:

RDPDFViewController.m:65:19: Implicit conversion of C pointer type 'PDF_DOC' (aka 'struct _PDF_DOC *') to Objective-C pointer type 'PDFDoc *' requires a bridged cast

It's from the method:
- (int)PDFOpen:(NSString *)path withPassword:(NSString *)pwd

... and from the line:
[m_view vOpen:m_doc: self];

The similar line in the example project works fine.

I'm not very experienced iOS developer, but as far as I can understand it's a problem with Objective C <-> C++ interface? Any help is appreciated.

Please Log in or Create an account to join the conversation.

error: Implicit conversion of C pointer type... 10 years 1 month ago #5609

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
PDF_DOC is struct in C language.
PDFDoc is obj-c class. it's different.

Please Log in or Create an account to join the conversation.

error: Implicit conversion of C pointer type... 10 years 1 month ago #5610

  • starcutdec
  • starcutdec's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 2
  • Thank you received: 0
Thank you radaee for your reply. I can appreciate the fact that they are different.

However it's the unmodified example code from help_iOS_1.7.pdf and that compilation error doesn't occur in the example project which too has a similar line.

Maybe I'm missing some compilation flag etc.? I did use the -lstdc++ flag. I also double (even triple) checked that I did everything as is instructed in help_iOS_1.7.pdf but I might have misunderstood something.

While I have pretty long programming experience, I am rather new to Objective C.

What might cause the compilation error?

Please Log in or Create an account to join the conversation.

error: Implicit conversion of C pointer type... 10 years 1 month ago #5612

  • stronglee
  • stronglee's Avatar
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 93
  • Thank you received: 2
You can try add (__bridge void*) before error object,just like


id obj = [[NSObject alloc] init];
void *p = (__bridge void *)obj;
id o = (__bridge id)p;

This maybe cause by ios5 system.You can try the demo in ios6 and ios7.

Please Log in or Create an account to join the conversation.

error: Implicit conversion of C pointer type... 10 years 3 days ago #5992

  • imran.nazeer
  • imran.nazeer's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 27
  • Thank you received: 0
This issue still exists for me.
If i convert like with ( [m_view vOpen:(__bridge PDFDoc *)(m_doc): self];
Application getting crash.
www.dropbox.com/s/cw9un5wz4bu3fey/Screen...t%205.22.43%20PM.png

Please Log in or Create an account to join the conversation.

Last edit: by sheeraz_am.

error: Implicit conversion of C pointer type... 10 years 3 days ago #5995

  • stronglee
  • stronglee's Avatar
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 93
  • Thank you received: 2
Hi,which version demo you use?Could you show me some code where you use m_doc and definition of it?

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum