iOS xCode how to purge Objective C++ from a project? - objective-c

I got a demo project that had a single Objective C++ source file. I removed the file and renamed all files that touched it from .mm to .m . However, xCode still thinks that there is Objective C++ code in my project and refuses to refactor class names, etc:
I tried deleting the file I want to refactor from xCode project using Delete > Remove references, then re-added it. The file has .h and .m, nowhere does it import any .mm files. xCode still would not refactor, complaining about objective C++.
How can I disable/ purge Objective C++ from an xCode 5.1 project if I already removed and renamed all files? Is there some build setting I need to flip?

Apple Update Objective-C version 2.0 then they enable feature to allow C++ language variant with GNU & clang Compiler with certain restriction
Anyway
Apple & development team know why remove Objective-C++
But in Current Objective-C++ project not open And you Stuck So simply Go to your Project Folder And Rename Objective-C++ project file extension from .mm to .m , still work as well
What Objective-C++ Remove

Related

scons and ObjC++

I'm trying to use scons to build a cross-platform cpp project. Some of the files contain ObjC code, which is only included on OSX and hidden behind ifdef guards on other platforms.
On OSX, I need to include a few -framework compiler/linker options, which I do through
env.AppendUnique(FRAMEWORKS = Split('Cocoa CoreAudio AudioToolbox AudioUnit GLUT OpenGL'))
in my SConstruct file as it says in the docs.
However, the FRAMEWORKS variable only gets used for .m and .mm files, whereas mine all have the .cpp extension. I want to keep it this way, since they're only ObjC files on OSX, and just cpp on other platforms.
Is there a way to get scons to treat source files with a .cpp extension as ObjC++, to get it to use the FRAMEWORKS env var?
I checked the sources of the current version 2.3.4 and there is no support for the FRAMEWORKS variable when compiling source files, only for linking (applelink.py Tool).
So you'd have to define your own ObjC Builder, which then could use the already defined variables like $_FRAMEWORKPATH, $_FRAMEWORKS and $FRAMEWORKSFLAGS.
If you need more help with that, you might want to come over to our user mailing list scons-users#scons.org ( http://www.scons.org/lists.php ) where we could talk you through all the gory details. ;)

Xcode 5 compilation

I've got a project which is going to be a c++ library for use in other c++ code.
It's made of a single .cpp implementation file and a single .h file for the interface. Normally I'd just compile the .cpp implementation file and then link it with other files with g++ in something like Ubuntu, however in Xcode 5 there's the Option Product>Build, Product>Build for... Running,testing, profiling and then there are the Perform action options to compile analyse, pre-process and assemble individual files. So with Xcode 5 how exactly do I complete my c++ library project in that I can then include it in other programs? And what happens when I use the options mentioned above like build and compile, because I see no new output files even though the build is successful - I'm guessing they go somewhere else I don't know about. I've googled this but I mostly find Xcode 4 stuff.
Thanks,
Ben.

Objective-C ARC was enabled in PCH file but is currently disabled - Error

I am trying to convert my Objective-C Project to ARC. Once I add the -fno-objc-arc compiler flag to one or more individual files in Build Phases, my MyProject-Prefix.pch file shows the following error:
Objective-C automated reference counting was enabled in PCH file but is currently disabled.
You have to make sure that :
Compiler is set to Apple LLVM compiler 4.x
Project property : CLANG_ENABLE_OBJC_ARC is enabled (change it to YES)
You have cleaned your project (Product -> clean)
Following the steps above you will ensure that you have switched to ARC using the LLVM/clang compiler, if none of the above will solve the problem you can try disabling precompiled prefix unchecking Precompile Prefix Header (GCC_PRECOMPILE_PREFIX_HEADER) in XCode Build phases. The use of the PCH is not mandatory since is used to increase compilation time.

Using GLM .obj loader in an Objective-C program

I am trying to use GLM to load a .obj object in my Objective-C Program (Xcode 4.4 Mac Os X). I have added the glm folder to my project. i try to import it using #import "glm/glm.hpp", but the program doesn't build. some of the errors are the following: (this errors are produced in the GLM files)
namespace glm{ //Unknown type name 'namespace'
namespace detail
{ .....
It doesn't find the cstdlib, cmath, and other libraries.
This happens because my program is in Objective-c and the GLM doesn't work with this language?
Those are all symptoms of trying to compile a C++ application with a C compiler. Namespace is a C++ keyword, and cstdlib, cmath, etc. are C++ names for standard C headers. You'll have to migrate your project to Objective-C++ to be able to use GLM.
Any files that uses the GLM library will require that file extensions to be renamed to .mm as it uses Objective-C++. Also, as it is only a file, and not a framework, you only need to put #import "glm.hpp"

How to compile specific files in objective-c++ and the rest of the project in objective-c

I'm currently busy on a project where I need to use an external accessory to read Mifare 1k tags.
The accessory was provided with an SDK, written in (Objective ?)C++ and I followed the instructions provided to set XCode to "Compile sources as: Objective-C++" and added "-Obj-C++" in "Other linkers flags.
The SDK compiles fine then, but trouble is I am already using several libraries in the project (such as ASIHTTPRequest, JSONKit, ...) and I get compilation problems because of those new settings in those libraries. If I switch back to the previous settings, I get compilation problems in the reader's SDK
The question is: is there a way to compile only the class from the SDK as C++ and the rest of the project as objective-c ?
Edit: the SDK files consists only of .h (and a linked library)
thanks for your help,
Mike
Select the file you want to compile as Objective C++ from the file navigator, and then select the File Type in the file inspector view. This is in Xcode 4, but there is a similar mechanism in Xcode 3.
Try renaming the files where you are including the library headers to myClass.h for interface and myClass.mm for implementation files. This forces the files to be compiled as objective-c++.
I have resolved this problem:
You should set "According to file type" to "Complile Sources As",
Set "-ObjC++" to the "Other Linker Flags"
The last,you should modify the files's suffix to .mm that reference
the library method
well, in Build phases tab, there is a section Compile sources. For file you want to use Objective-C++ compiler add flag: -xobjective-c++
tested in Xcode 12.5