when trying to compile some c / c++ code for iOS. Getting
No member named 'memcpy' in namespace 'std::__1'; did you mean 'wmemcpy'?
Have tried the compiler settings with no luck.
This is in the memory file in the tool chain.
I needed to add
#include <cstring>
hope it helps
Related
Using C++ Builder 10.3 Update 2
I'm upgrading some existing software from classic Borland compiler to Clang 64.
The entire project consists of a number of static libraries, and some applications.
When building the final applications, I'm running into linker issues that look like this:
[ilink64 Error] Error: Unresolved external 'std::_Facet_base::_Facet_base()' referenced from XXX.A|xxx.o
[ilink64 Error] Error: Unresolved external 'vtable for std::locale::facet' referenced from XXX.A|xxx.o
[ilink64 Error] Error: Unresolved external 'vtable for std::ctype_base' referenced from XXX|xxx.o
The libraries are using std::stringstream, and std::readline, along with some other std library functions.
The general pattern that is causing the error is:
// mystaticlib.h
void foo();
// mystaticlib.cpp
#include <sstream>
void foo() {
stringstream ss;
// do some more stuff
}
// myapp.cpp
#include "mystaticlib.h"
void bar()
{
foo();
}
Is this a bug with the compiler/linker?
I've found these related questions (and more):
Undefined reference to vtable
Linking error: undefined reference to `vtable for XXX`
Linker error: undefined reference to vtable
But the answers generally boil down to "implement the missing functions".
Since this is the std library delivered with the product, I'm hesitant to start changing it.
I'm fairly familiar with C++ Builder, and C++ and I've tried investigating all the basic stuff.
This code did compile, link and run using C++ Builder 10.3 with the classic 32 bit compiler.
This is so low level that I'm having a hard time figuring out what is wrong.
Because of reasons, I would prefer not to update to 10.4 at this time.
I also saw that there is a 10.3.3 release, but I was hoping not to upgrade unless I specifically had to to fix this problem.
Xcode gives me this weird error: Use of undeclared identifier 'vabs_s8'
File path: /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/simd/common.h
This file is included by GameKit framework:
GameKit.h => simd.h => vector.h => common.h
Any suggestions how to fix this?
This error is to do with the architecture your targeting. A simple workaround is to place these at the top of common.h file.
#undef arm64
#undef arm
As you've noticed,gamekit includes simd/common.h in which ‘vabs_s8()’ function is undeclared.
Naturally, simd/common.h includes simd/base.h -> and -> simd/base.h includes arm_neon.h if ARM_NEON is defined. In arm_neon.h we have the declaration of ‘vabs_s8()’ function.
So if vabs_s8 is undeclared means the header is not included which means __ARM_NEON__ is not defined.
__ARM_NEON__ is enabled by default if you target armv7/arm64, so this means there might be something wrong with your project settings.
Solution: One of our programmers found out that adding "-mfpu=neon" in Other C Flags fixes this issue.
I have an xcode 6 swift project and I am trying to use C++ with it. In my project on the left I clicked 'new file' and I chose empty C++ file. Then I click yes and xcode generated Bridging-Header.h file.
In my new .cpp file I have #include <string>. I tried to compile the file and everything compiled fine. Later I realized that I forgot to include the .cpp file in the bridging-header.h because my swift files didn't have access to a function in my .cpp file. When I added the #import "cplusplusfile.cpp" in the bridging-header file, I get this error on this line:
#include <string> (!)'String' file not found
my goal is to get a string the user enters in a UITextField and send that string from my Swift files to a function in my C++ file so then I can use C++ to write that string to a file (I don't know how to read/write files in swift and couldn't find much on it..).
Would anyone know possible solutions? I looked online and other questions. One of the solutions was to change my cplusplusfile.cpp to cplusplusfile.mm. Unfortunately it didn't help :(
I'll answer something completely different cause I know you're going in the wrong direction, using C++ just to write a string to file is running around in circles, you want to use NSString and write that string directly to a file, in swift you can use the method
func writeToFile(_ path: String,
atomically useAuxiliaryFile: Bool,
encoding enc: UInt,
error error: NSErrorPointer) -> Bool
And give it a string which is the filename and the string to write get that by reading it directly from your UITextField by using myTextField.text, it should write that to file right away.
Good luck learning swift ! :)
also here's the class reference for NSString
Use following instead:
#import <string.h>
I need to download and unzip a file in my Xcode project,
I am using Ziparchive (https://code.google.com/p/ziparchive/downloads/detail?name=ZipArchive.zip) to do so,instead of following every step I am getting compilation error as below:
/Developer/AR/vuforia-sdk-ios-2-6-8/samples/ARDemo/minizip/ioapi.c:68:18: Redefinition of 'fopen_file_func' as different kind of symbol
/Developer/AR/vuforia-sdk-ios-2-6-8/samples/ARDemo/minizip/ioapi.c:68:35: Use of undeclared identifier 'opaque'
/Developer/AR/vuforia-sdk-ios-2-6-8/samples/ARDemo/minizip/ioapi.c:68:58: Expected ';' after top level declarator
/Developer/AR/vuforia-sdk-ios-2-6-8/samples/ARDemo/minizip/ioapi.c:72:1: Expected unqualified-id
/Developer/AR/vuforia-sdk-ios-2-6-8/samples/ARDemo/minizip/ioapi.c:90:17: Redefinition of 'fread_file_func' as different kind of symbol
Developer/AR/vuforia-sdk-ios-2-6-8/samples/ARDemo/minizip/ioapi.c:90:42: Use of undeclared identifier 'stream'; did you mean 'strcat'?
Developer/AR/vuforia-sdk-ios-2-6-8/samples/ARDemo/minizip/ioapi.c:90:50: Use of undeclared identifier 'buf'
/Developer/AR/vuforia-sdk-ios-2-6-8/samples/ARDemo/minizip/ioapi.c:95:1: Expected unqualified-id
I dont have a clue how to compile it successfully, any help is appreciated.
In my case, it happens because I have an incorrect Prefix file.
It was including objective c imports outside the "#ifdef OBJC" block
So that there was no problem when all classes were objetctive-C classes but it didn't compile when I add the C classes of minizip.
Just moving all the imports in the prefix file inside the obj block and voilà!
#ifdef __OBJC__
#import <Availability.h>
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
I hope this helps
Please Add the FrameWork libz.dylib in your project and solve your problem
Project setting -> Target-> Build Phases -> Linked Frameworks and Libraries -> select ibz.dylib
I got the solution,I am using Metaio SDK for Augmented Reality which has a compile dependancy, it can only be compiled as "Compile sources as - > Objective C++" and this was the reason creating the problem, Ziparchive compiled fine otherwise, now to merge both in the same project I made Ziparchive as a STATIC LIBRARY and linked it in Xcode, it solved the problem.
I followed Claus's post to set up code coverage on Xcode 4.2 with LLVM 3.0. I'm able to see test coverage files, but they're only for my unit test classes, not my actual project classes. I've tried setting Generate Test Coverage Files and Instrument Program Flow to Yes on my main target, but that didn't help, as it failed with the following error:
fopen$UNIX2003 called from function llvm_gcda_start_file
To clarify, I don't think that's even the right approach - I just tried it to see if it would generate code coverage on my project classes.
At this point, I'd be happy to try anything that gets code coverage working on my app. Any suggestions?
You are expecting linker problem, profile_rt library uses fopen$UNIX2003 and fwrite$UNIX2003 functions instead of fopen and fwrite.
All you need is to add the following .c file to your project:
#include <stdio.h>
FILE *fopen$UNIX2003( const char *filename, const char *mode )
{
return fopen(filename, mode);
}
size_t fwrite$UNIX2003( const void *a, size_t b, size_t c, FILE *d )
{
return fwrite(a, b, c, d);
}
This code just remaps the missing functions to standard ones.
Note on $UNIX2003 suffix:
I've found an Apple document saying:
The UNIX™ conformance variants use the $UNIX2003 suffix.
Important: The work for UNIX™ conformance started in Mac OS 10.4, but was not completed until 10.5. Thus, in the 10.4 versions of libSystem.dylib, many of the conforming variant symbols (with the $UNIX2003 suffix) exist. The list is not complete, and the conforming behavior of the variant symbols may not be complete, so they should be avoided.
Because the 64-bit environment has no legacy to maintain, it was created to be UNIX™ conforming from the start, without the use of the $UNIX2003 suffix. So, for example, _fputs$UNIX2003 in 32-bit and _fputs in 64-bit will have the same conforming behavior.
So I expect libprofile_rt to be linked against 10.4 SDK.
I use CoverStory http://code.google.com/p/coverstory/ a GUI for .gcda and .gcno files.
The documentation explains the settings needed to generate these files http://code.google.com/p/coverstory/wiki/UsingCoverstory.