Solution to adding the open-source library zxing to the xcode Project

Source: Internet
Author: User

Today, we need to use the QR code scanning function to port the zxing of a demo that can be correctly run to a new project, but the iostream file not found problem occurs. The solution is as follows.

Refer to the following article to add zxing to xcode.

Http://yannickloriot.com/2011/04/how-to-install-zxing-in-xcode-4/

But I followed the above method and the error message is still displayed, so I did it myself and operated it again to add zxing to xcode.

In fact, there are several main steps:

1. Download The zxing code library and decompress it. Copy the zxingwidget directory and zxing under the CPP/CORE/src directory to the project directory. It must be at the same level as the. xcodeproj file of the project.

2. Double-click zxingwidget. xcodepro to open the project. First, ensure that the zxingwidget project is successfully run separately, so that it can be added to the target project.

In the zxingwidget project, create a groud under classes and name it coresrc. Like the test example given to zxing, drag the copied directory zxing to coresrc. This solved the problem of missing files that I dragged the zxingwidget project of the demo project to the target project. (Because the file directory structure of the target project is inconsistent with that of the demo project ).

3. Compile the zxingwidget project and pass it smoothly. In this case, you can add the zxingwidget to the target project.

4. After zxingwidget is added to the target project, the problem of iostream file not found still occurs after compilation. Shit, this is silly. Continue to Google and find someone asking this question. The solution is to change the implementation file, that is, the. M file, to. Mm. After some comparison of the demo project, we found that in the demo project, the file that calls zxingwidgetcontroller is suffixed with. Mm. So modify it immediately. Compile again. This time, the sky is finally shining, and the iostream file not found error is gone. But there are some other errors. Therefore, the dependent libraries are added and then compiled. Finally, we can see the long-overdue scanning interface.

PS: after solving the problem of iostream file not found in step 1, several other problems emerged (non-dependent library missing issues). Later, I checked them carefully, it is found that it is under the zxing directory added by step 1. the CPP file is not added to the build phases-> compile sources list. The problem is solved after being added again. At this time, I was a bit confused. I dragged all the folders into the project and should have automatically added them to the compilation list. It seems that you will need to look at the file compilation list in the future. Do not trust the system too much.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.