Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiling example QZXingLive : application.cpp:(.text+0x234): undefined reference to `NativeHelpers::application_p_' #234

Open
lycaon-qc opened this issue Apr 18, 2023 · 1 comment

Comments

@lycaon-qc
Copy link

Hi,

I was able to use QZXing on a Ubuntu 20.04.6 LTS and decode various type of printed barcode (e.g. EAN 13, QR-code, data matrix code) using the webcam of my laptop (i.e. Chicony USB 2.0 webcam). The QZXing worked well, and I didn't have an issue during installation.

I was also able to compile and run the following examples provided in "[...]/qzxing-master/examples" : QZXingDragNDropTest and BarcodeEncoder.
However, for QZXingLive, although I was able to run qmake, running make failed and gave the following error message:

usr/bin/ld: application.o: in function 'Application::Application()':
application.cpp:(.text+0x234): undefined reference to 'NativeHelpers::application_p_'
collect2: error: ld returned 1 exit status
make: *** [Makefile:753: QZXingLive] Error 1

I looked in the issues here https://github.com/ftylitak/qzxing/issues and elsewhere, but I have not seen that someone had a similar issue previously when compiling QZXingLive.

I have not modified anything in "[...]/qzxing-master/examples/QZXingLive", except of course running qmake and make.

Does anyone out there did came across this problem and was able to fix it?

I am using a Ubuntu 20.04.6 LTS, the C++ compiler is GNU g++ 4:9.3.0-1ubuntu2 amd64, and the QMake version is 3.1 using Qt version 5.12.8 in /usr/lib/x86_64-linux-gnu.
Let me know if additional information would be helpful.

@1nvoker
Copy link

1nvoker commented Mar 23, 2024





你好,我也遇到了同样的问题,我是这样解决的。QZXingLive.pro 中35行至39行,条件性(目标为android 并且qt版本小于6.2)地包含了native.h和native.cpp。由于你编译的目标是linux,navtive.h,navtive.cpp没有包含在编译列表中,所以编译器找不到。将这两个文件加到HEADERS和SOURCES,就可以编译通过了。像这样

Hello, I also encountered the same problem, and this is how I solved it. QZXingLive.pro includes native. h and native. cpp conditionally (target is Android and qt version less than 6.2) from lines 35 to 39. Since the target you are compiling is Linux, navtive. h, and navtive. cpp are not included in the compilation list, the compiler cannot find them. Add these two files to HEADERS and SOURCES to compile them successfully. As follows

17 HEADERS +=
18 application.h
19 native.h

20 SOURCES += main.cpp
21 application.cpp
22 native.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants