 |
 |
C++, Cocoa, and Project builder not getting along
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jul 2001
Status:
Offline
|
|
For the life of me, I CANNOT get project builder to either interprit C++ code in a cocoa application or use cocoa libraries in a C++ application (ie, from the new project menu). I've added libc++.a or whatever to the cocoa application and Foundation, AppKit, and cocoa frameworks to the C++ project, but the cocoa project says undefined "class" and the C++ application says error, Undefined symbols. I just want to use C++!! I can't even get C++ to work in a carbon application (it says class undefined). What's going on here!? 
|
|
|
| |
|
|
|
 |
|
 |
|
Admin Emeritus 
Join Date: Oct 2000
Location: Boston, MA
Status:
Offline
|
|
LOL. Odd, I was just going to ask a question regarding the progress of Objective-C++.
Objective-C is an extension to C, not C++, so C++ syntax won't work there.
Objective-C++, though, will accept C++ in Objective-C code. Files that end in ".M" (as opposed to the lower-case variant) are Objective-C++ files, but Apple hasn't included the Objective-C++ compiler in OS X, so you'll get an error about the pipe being closed, ccobj1plus not existing, or something.
We can only wait. :-)
[ 07-24-2001: Message edited by: parallax ]
|
|
"Against stupidity, the gods themselves contend in vain" (Schiller)
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jul 2001
Status:
Offline
|
|
NO!!!!! Say it isn't so!
heh, I knew it was something along those lines.
There's no option when you create a new file to create an Objective-C++ file, but there IS an option to save a copy of a file as an Objective-C++ file, thus my confusion as to why it wasn't working either way. (I actually got a file with a .mm extension when I saved as objective-c++ file, I'll try adding a .M extension to see if the 1.0.1 version of project builder did anything. I doubt it. ) Well, as an easy workaround, is it possible to get the project builder to build an objective C file and a C++ file seperately and then link them together? I have a group of objects and class methods in the C++ file, but in the main file, I only need to call a C function from that C++ file to initiate the program. Otherwise, how do I create a cocoa project in CodeWarrior pro 6 (the osx version).
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jul 2001
Status:
Offline
|
|
AHA! I discovered a workaround for my situation. I'm actually working on a GLUT project, and I'm not really using cocoa libraries. I'm using a cocoa project to avoid the hastle of setting up all the windows and stuff in Carbon. So, here's how I made a project where I could use C++ code to make an OpenGL Glut game.
1) New project
2) Select Cocoa Application
3) Select File>New File
4) Select C++ file
5) Name it main.cpp or something similar, make sure you add it to the current target
6) delete main.m from your project
7) Add Framework GLUT.framework
8) type code in main.cpp
Header files seem to default to objective C in my configuration, so you may have to use only .cpp files for additional C++ files instead of headers. 
|
|
|
| |
|
|
|
 |
|
 |
|
Admin Emeritus 
Join Date: Oct 2000
Location: Boston, MA
Status:
Offline
|
|
Naw, you can also use Carbon, since GLUT manages the hassle of setting up windows (it's completely platform-independent, so all GLUT code will work no matter what libraries use... Carbon... Cocoa... X... Win32, &c)
|
|
"Against stupidity, the gods themselves contend in vain" (Schiller)
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status:
Offline
|
|
On Objective-C++, recent posts to the darwin-development mailing list suggest that it will be part of the developer tools that come out concurrently with the 10.1 release.
(darwin-development archives are on www.darwinfo.org)
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|