Make sure you compile that file as “Objective-C++”.
The simplest way is to rename it as *.mm.
If you don’t want to rename the *.m file,
- Select your file.
- Open the File Info dialog (Cmd+I)
- In File Type, select “sourcecode.cpp.objcpp”
More Related Contents:
- What is Objective C++? [closed]
- Compiling external C++ library for use with iOS project
- C++ if statement/xcode [closed]
- OpenCV C++/Obj-C: Detecting a sheet of paper / Square Detection
- static variable link error [duplicate]
- Can I mix Swift with C++? Like the Objective-C .mm files
- How exactly does __attribute__((constructor)) work?
- Calling Objective-C method from C++ member function?
- Combine static libraries on Apple
- Is it possible to program iPhone in C++
- OpenCV C++/Obj-C: Advanced square detection
- Can I use C++11 with Xcode?
- using \ in a string as literal instead of an escape
- Use C++ with Cocoa Instead of Objective-C?
- Can I separate C++ main function and classes from Objective-C and/or C routines at compile and link?
- Code runs perfect in g++ but not in Xcode – Cannot find File
- Qt Creator – Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild
- Mixing Objective-C and C++
- Linking Libraries in Xcode
- New to Xcode can’t open files in c++?
- How can I avoid “duplicate symbol” errors in xcode with shared static libraries?
- Configuring compilers on Mac M1 (Big Sur, Monterey) for Rcpp and other tools
- How do unsigned integers work
- xcode with boost : linker(Id) Warning about visibility settings
- Relative Paths Not Working in Xcode C++
- Compile OpenMP programs with gcc compiler on OS X Yosemite
- Image edge smoothing with opencv
- Missing C++ header after updating OSX Command Line Tools 6.3
- Register UncaughtExceptionHandler in Objective C using NSSetUncaughtExceptionHandler
- How can you compare two character strings statically at compile time