Note that there are some explanatory texts on larger screens.

plurals
  1. POIncluding a C++ header in an Objective-C project yields "Expected * before *" errors
    primarykey
    data
    text
    <p>I'm new to Objective C and (unfortunately) also to the project I am working on. I was given a small sample project that refers to work from my predecessors (in C++) and uses it for an iPhone app (Objective C). Rather than extending the sample (it was quick n dirty and I didn't wanna mess around in it) I created a new project from scratch for my stuff. To get it working I need to set up the same links to the previous libraries as the other one, but although in my settings I can't find any differences to the existing project it won't do the trick.</p> <p>With the help of colleagues and Google I reached this:</p> <p>1) The project includes two library files, libyid.a and libvrpn.a, via Xcode's "Add files" dialogue. It automatically added the libraries' paths to the Library Search Paths in the Build Settings and the files show in the projects folder structure in XCode. <strike>As far as I can tell this bit seems not to cause problems.</strike> Edit: if i remove these files from the project I get the same errors. I'm now thinking that XCode can resolve the headers, but can't find the implementation and that the libraries may have been there but not been properly set up?</p> <p>2) One of my custom classes uses </p> <pre><code>#import "DisplayYid.h" </code></pre> <p>I added the path to the file's location to the "Header Search Paths" in the Build Settings and it seems to be found alright. (I also added the file via the "Add files" dialogue at some point, but it didn't change anything, so I left it this way)</p> <p>Now the problem: in</p> <pre><code>@interface YidController : NSObject { DisplayYid *myYid; // (etc. etc.) } </code></pre> <p>the identifier "DisplayYid" seems to remain unknown (Error: Expected specifier-qualifier-list before DisplayYid). In addition, all the class definitions in the headers that DisplayYid itself includes yield </p> <p><code>error: expected '=', ',', ';', 'asm' or '__attribute__' before '__declspec'</code></p> <p>My knowledge here is unfortunately very limited, but it seems to me that XCode can find the headers in question, but somehow would expect the content in a different format/language? When I had DisplayYid.h included as a file in the project hierarchy I tried to set its file type in the file inspector to "C++ header" (as suggested by some hits I found on Google for my problem), but this doesn't change a thing. I feel I am missing some tiny but crucial detail, but am not sure-footed enough in any of this to test around further. Hopefully somebody sees my missing link? And sorry if this is too lengthy, I simply tried to include the detailed steps in case this is were the problem lies.</p> <p>Thanks in advance for your time ;)</p> <p>EDIT: <a href="https://stackoverflow.com/questions/990906/iphone-error-expected-asm-or-attribute-before-foo">This question</a> seems to be the same problem, especially the fact that he gets the error multiple times from files simply copied. But none of the suggested solutions seem to work for me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload