ios7 with zxing, probably c++ compiler error - iphone

I get through zxing readme, and I searched for similar problems, because I know that was common error. But I still have problem with that. Im getting errors like:
Undefined symbols for architecture i386:
"std::string::compare(std::string const&) const", referenced from:...
I have c++ language dialect and c++ standard library changed to compiler default. But i have Compiler for c/c++/o-c set to Apple LLVM 5.0.
If I need to provide any screenshots or something, just tell me.

It sounds as if your library was built with libstdc++ as the C++ standard library. Try changing to that setting in your project instead of libc++, clean and rebuild.
Alternatively (and a better choice for the future of your project), see if there's a version of the library built with libc++.

With the release of iOS 7, Apple included the ability to detect barcodes through its AV Foundation framework. The supported types are:
UPC-A, UPC-E, Code 39, Aztec, PDF417, QRCode and maybe 3 or 4 more.... so there is no need to use ZXing anymore.

Related

How to access all Swift standard lib source code or module definitions from within Xcode?

Currently we can access a particular module in Swift by command + clicking a particular Swift type. Is there a way to easily access all Swift modules / standard libraries from within Xcode?
Is there a way to debug into Swift source code like one can in Android?
Is there a way to debug into Swift source code like one can in Android?
The answer depends on what you mean by "all Swift modules / standard libraries".
If you are interested in the Swift's standard libraries (i.e. clases like String or Array), then Swift was open-sourced by Apple and you can find sources on github following links from https://swift.org/source-code/. Still there seems to be no way to "attach" those sources to navigate there from your XCode project.
However, if you are interested in most of the MacOS or iOS frameworks such as UIKit and many others, then I believe the answer is NO.
Unlike Android, iOS is a proprietary closed source OS and in most of the areas Apple has no intentions to share its code with everyone.
Side Note: Once it was claimed that one of major reasons for Apple to switch its tools from GCC stack to Clang/LLVM stack was that GCC is licensed under "copyleft" GPL and thus Apple couldn't integrate parts of GCC Obj-C backend (such as code analysis or stuff useful for refactoring) into XCode even if those parts were developed by Apple itself without making whole XCode open source. Clang/LLVM on the other hand uses more permissive open-source license that allows such 3rd-party usages.
Moreover much of the Apple's internal code still must be in Objective-C or even plain C rather than Swift. It is relatively easy to convert "headers" i.e. interfaces specification from Obj-C to Swift automatically but it is very hard for real implementation especially given difference between Obj-C and Swift. So even if it was an open-source, there would be no debugging in Swift.
On a positive side: some code gets executed and Apple can't hide it and thus you can debug it. The only problem is that the code is in machine language helpfully decoded into Assembly (x86 or ARM) by XCode. However, it obviously requires some skill and time to understand any non-trivial logic from that. And beware that you probably can't copy logic found that way without violating some copyright laws.
Swift is open source. So you can get its code and modules here.
However, you can't do it with command + clicking in Xcode from your own project. In fact, the code you got from command + clicking was not Swift source. They were headers that were generated by the compiler automatically. Those headers may be generated from Swift source code, or even Objective-C code.
Also, even though you can get source code and edit it, you can't use it on your app that you want to be published to App Store. You can only use the Swift comes with Xcode to published to App Store, or your app will be rejected.

How to build mathomatic lib for iPhone?

I want to compile the mathomatic(CAS) library for iPhone. I am not able to find any place where to define the "HANDHELD" flag which helps to compile the library for mobile devices.
You can find the library from mathomatic.
I have already compiled library but when I am trying to use that library then xcode is throwing error like "libmathomatic.a doesn't contain slice for i386" so, I have tried to get the architecture info using lipo command so, it showing x86_64. It might be looks like compiled library is for OSX not for iPhone so, what changes I need to do to compile it for iPhone? I have already taken look into make file but I am not getting how to define or change the architecture.
Help would be highly appreciated.
Thanks in advance.

Create a single iOS framework-file from ZXing QR reader project

I have been looking for 2 days now, trying to find a way to get a single iOS framework-file for the ZXing QR reader. The only thing i can find, is a ZXingWidget project to include in my own project. But here, i have to add path's, dependencies etc. for it to work.
Isn't there a way to create one single .framework file that can easily be added to any new projects needing this feature?
I have found a kstenerud iOS framework template to create frameworks, but i can't make it work with the ZXing project.
No, there's no good solution for this for iOS.
Frameworks are generally (always?) dynamically-linked libraries and Apple doesn't allow DLLs on iOS. Note that there are now framework builds for OS X.
It may be possible to hack Xcode to produce a framework with a statically linked library, but that's going against Apple's patterns which means I suspect it will push Xcode into corner cases which fail in subtle and hard to debug ways and which have a high chance of breaking across Xcode versions.
This opinion comes in part from talking to Apple Xcode engineers at WWDC about cleaning up the ZXing project files. There are new project files now that follow all the best practices they recommended but on iOS they still require the same include path and library linkage project customization that the old project files require.

Is TA-lib.org support on iOS on iphone?

I would like to add Technical analysis support to my financial project on iphone. And I found TA-lib on www.ta-lib.org, this library supports many indicators I need.
I would like to ask: Can I use ta-lib on my iphone development? And how I can do it, because this library is written in C language? I knew that Cocoa can compile C but how I can do it, import this library to iOS?
Any help would be appreciated.
Thanks
The iPhone SDK tools will compile most portable C code just fine (C is a pure subset of Objective C). There appears to be C source code available for the library in which you're interested. If so, you could try just including the source to the library in your iPhone Xcode project, and see if it all compiles, which it might if there are no dependency or collision problems. You may or may not need the entire library, which might help simplify things (or not).
You could also compile a separate static library, and then include that library, and the headers, in your iPhone app; but that technique may be a bit more complicated that your requirements might indicate.

Lua on the iPhone?

I am trying to use Lua on the iPhone. On Mac OS X, in a normal (non-iOS) Cocoa application, I used the following code:
lua_State* l;
l = lua_open();
luaL_openlibs(l);
luaL_loadstring(l, "print(\"Hi from Lua\");");
lua_pcall(l, 0, 0, 0);
I downloaded Lua 5.1.4 from lua.org/ftp and compiled it for Mac OS X.
In the Xcode project, I used "Add Existing Framework" to add liblua.a and I used "Add Existing Files" to add the include directory.
This works as expected, and prints the string: "Hi from Lua".
When I try the same thing in an iOS project, it gives the errors:
"_luaL_newstate", referenced from:
_main in main.o
more of the same thing...
symbol(s) not found
collect2: ld returned 1 exit status
It seems that the .a file is not linked into the iPhone app.
Does anybody know how to make this work?
(By the way, I don't really care that Apple might not accept my app if it has Lua in it.)
You'll need to compile the Lua .a for ARM, not Intel. If the Lua library uses autoconf, you can use my favorite iphone/autoconf builder: build_for_iphoneos. If it's not autoconf, then you can use that script to get an idea of how to attack it. Sometimes you can just build a Static Library Xcode project, dump all the files into it and hit build. If the build is simple enough, it'll do most of the work for you.
I know it doesn't matter for your use, but Lua-based tools are generally shippable on the app store. You just can't download arbitrary code at run time and interpret it.
You might want to check out iPhone Wax. It is a lua/iPhone bridge that lets you write native iPhone apps in pure lua! Here is a pretty good tutorial about it.
If you want to write Lua code for iOS, then check out MOAI immediately: http://getmoai.com/
Its an absolutely enjoyable framework for developing games on iOS and Android, as well as Windows and OSX. Not only that, but it provides a pretty good idea of how to properly implement a Lua-VM based hosting environment for scripting in a cross-platform manner: from MOAI, you can learn a lot about this. I've done 4 titles with MOAI so far, and won't be stopping any time soon .. MOAI absolutely kicks ass!
Also check out LOAD81, which is a similar effort albeit with SDL as the target environment: http://github.com/antirez/load81
(I've contributed a little to the LOAD81 project, specifically giving it features of interest/value to the OpenPandora community. MOAI is more commercial, LOAD81 more hobbyist..)
For those trying to learn Lua and the different methods of integrating the Lua VM in a project for multiple platform targets, both MOAI and LOAD81 can provide a lot of great background and clues about the right way to proceed.