Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tier 2 issue in Xcode (converting from Tier 1)

Author
Message
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 9th Jul 2012 23:06
Okay, after getting fed up trying to 'fix' a randomish error that was related to garbage collection of strings (and other bits), I decided to convert my WIP game from Tier 1 to Tier 2. (I know it was in the garbage collection because the Xcode output pointed directly into the interpreter.cpp file or to assembly language version of cFile.cpp and complained about trying to release memory that wasn't allocated.)

I have been assured that I would be able to build my Tier 2 app in Xcode and cygwin for the appropriate platforms. So, I bit the bullet so that I would have better control.

I am 90% done with the conversion and wanted to test a bit in Xcode.

My VS2010 project builds and the stubbed app (it doesn't call all the actual startup functions, yet) worked fine.

When I made an iOS project for an Xcode 4 AppGameKit template (that does compile and run) and added all my header/code files, the compile would not work. And it wasn't in any of my files.
These are the first set of errors (of 78 before it stopped compiling because of too many errors):


These lines had a total of 52 errors flagged, mostly 'Unknown type' and 'Use of an undeclared identifier' caused because the compiler didn't like the first line shown here:


Yes, the problem is occurring in an Xcode sdk.

Has anyone run into this and do you know how to fix it?

Very frustrated.

I'm going to go see what happens when I try to do an Android build in cygwin/Eclipse.

Cheers,
Ancient Lady
AGK Community Tester
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 9th Jul 2012 23:46
i know it's a stupid question but did you leave the agk file directory structure as is, so that all include paths are relative?

i mean just make a copy of the xcode4 template in that SAME directory, rename it to your game name, and try to see if all compiles fine in their.

then you can experiment to move the directory somewhere else
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 10th Jul 2012 00:03
Quote: "i mean just make a copy of the xcode4 template in that SAME directory, rename it to your game name, and try to see if all compiles fine in their."

I believe that's what she has done. Check the paths at the beginning of the errors.

I'm not sure about this one. It looks like it has something to do with Objective C?

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 10th Jul 2012 01:02
Yup, that is what I did.

The issue is not finding files, it's the content of one of the Xcode library files.

When I build the template alone, it is okay. And it includes the same agk.h file that includes the common.h file that includes the foundation.h file.

Cheers,
Ancient Lady
AGK Community Tester
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 10th Jul 2012 02:11
If you like, you can post the project (or email me) and I can play around with it. I work better hands-on with things like this.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 10th Jul 2012 04:17
Hodgey, the project currently has 21 .cpp/.h file sets.

I just got the idea (after looking at the files involved) that using a file named 'constants.h' might or might not be conflicting with something somewhere.

I'm going to play with building the Xcode project by adding single file sets at a time to see if I can trigger the errors starting up. Or by adding the content of the files to the working template project and see if it still causes an error.

I was just hoping someone had seen the same thing happen.

I'd hate to have to put everything into the template.h and template.cpp files.

I'll keep fiddling with it.

Cheers,
Ancient Lady
AGK Community Tester
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 10th Jul 2012 19:19
Okay, this does not make a lot of sense.

I started with a fresh copy of the working iOS template, compiled and ran it okay.

Then I started adding files from my main project, one at a time. And the compile error popped up the instant I added a .cpp file that included a file that included "agk.h".

All files in the project were built successfully (including template.cpp) except common_functions.cpp. It failed when it included common_functions.h which included "agk.h" which included other stuff ending up with the file that did not work right.

template.cpp also includes common_functions.h, I even tried making it the first file included (ahead of template.h).

Then I figured it out. I copied the compile statement used for common_functions.cpp. Then I had to figure out how to get template.cpp to fail and give me the same output (and I did) and compared the compile statement.

The difference was that the template.cpp file was compiled as objective-c++ and common_functions.cpp was compiled as plain c++.

The fix is to set 'Compile Sources As' to 'Object-C++' instead of 'According to file type'. This option is found under the 'Apple LLVM compiler 3.1 - Language' section in 'Build Settings' for TARGETS <projectname>.

Now, I'll update my ios template project so that I won't have to rediscover this every time.

Cheers,
Ancient Lady
AGK Community Tester
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 10th Jul 2012 23:31
i think you can also right click on each cpp file and choose to treat it as c++

that was if you have other obj-c files, all would work
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 13th Jul 2012 19:39
Quote: "the template.cpp file was compiled as objective-c++ and common_functions.cpp was compiled as plain c++"


I got caught out by this when I first tried compiling in XCode, took me ages to figure out what was wrong. bjadams is right that you can change it on a per file basis, XCode 3 had a right click menu to do it, XCode 4 has a right hand side panel with the file properties.
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 14th Jul 2012 05:20
Yes i done my personal template since i started to use AGK.
So you can resuse it everytime you start a new project.

Long life to Steve!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 23rd Jul 2012 18:07
I know about the per file setting. But it was just as easy to do all and then not worry when/if I add more files.

I made sure my 'new' template now has that setting, so future projects should work smoothly.

Cheers,
Ancient Lady
AGK Community Tester

Login to post a reply

Server time is: 2024-05-05 15:43:22
Your offset time is: 2024-05-05 15:43:22