2013-02-13 2 views
3

Я получаю некоторые ошибки при интеграции Tesseract SDK в приложение iOS. Процедуру я следовал -Ошибки в интеграции Tesseract в приложении iOS

1) Потянулись "libtesseract_full.a" в Xcode 2) Потянулись папку "tessdata" в Xcode 3) Потянулись "baseapi.h" в Xcode

Теперь, когда я используя тессеракт -

// init the tesseract engine. 
tess = new TessBaseAPI(); 

tess->SimpleInit([dataPath cStringUsingEncoding:NSUTF8StringEncoding], // Path to tessdata-no ending /. 
       "eng", // ISO 639-3 string or NULL. 
       false); 

Я получаю эти ошибки ниже (я думаю, что есть какой-то рамки или что-то подобное, что не хватает, но не получить то, что не хватает, тессеракт демонстрационный проект работает отлично на моей системе)

clang: warning: argument unused during compilation: '-stdc++' 
ld: warning: CPU_SUBTYPE_ARM_ALL subtype is deprecated: /Users/saurabhsharma/Desktop/Tess/SnapXv2/libtesseract_full.a(libtesseract_full.o) 
Undefined symbols for architecture armv7: 
    "std::basic_ostream<char, std::char_traits<char> >& std::operator<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from: 
     SVNetwork::SVNetwork(char const*, int) in libtesseract_full.a(libtesseract_full.o) 
    "std::_Rb_tree_decrement(std::_Rb_tree_node_base*)", referenced from: 
     std::_Rb_tree_iterator<std::pair<char const* const, int> >::operator--() in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree_iterator<std::pair<int const, VariableContent*> >::operator--() in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree_iterator<std::pair<std::pair<ScrollView*, SVEventType> const, std::pair<SVSemaphore*, SVEvent*> > >::operator--() in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree_iterator<std::pair<int const, ScrollView*> >::operator--() in libtesseract_full.a(libtesseract_full.o) 
    "std::string::operator+=(char const*)", referenced from: 
     ScrollView::SendPolygon() in libtesseract_full.a(libtesseract_full.o) 
    "std::ios_base::Init::Init()", referenced from: 
     __static_initialization_and_destruction_0(int, int) in libtesseract_full.a(libtesseract_full.o) 
     __static_initialization_and_destruction_0(int, int) in libtesseract_full.a(libtesseract_full.o) 
    "std::string::size() const", referenced from: 
     SVNetwork::Flush() in libtesseract_full.a(libtesseract_full.o) 
    "std::__throw_length_error(char const*)", referenced from: 
     std::vector<int, std::allocator<int> >::_M_insert_aux(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >, int const&) in libtesseract_full.a(libtesseract_full.o) 
    "std::string::erase(unsigned long, unsigned long)", referenced from: 
     SVNetwork::Flush() in libtesseract_full.a(libtesseract_full.o) 
    "std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from: 
     std::_Rb_tree<int, std::pair<int const, ScrollView*>, std::_Select1st<std::pair<int const, ScrollView*> >, std::less<int>, std::allocator<std::pair<int const, ScrollView*> > >::erase(std::_Rb_tree_iterator<std::pair<int const, ScrollView*> >) in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree<std::pair<ScrollView*, SVEventType>, std::pair<std::pair<ScrollView*, SVEventType> const, std::pair<SVSemaphore*, SVEvent*> >, std::_Select1st<std::pair<std::pair<ScrollView*, SVEventType> const, std::pair<SVSemaphore*, SVEvent*> > >, std::less<std::pair<ScrollView*, SVEventType> >, std::allocator<std::pair<std::pair<ScrollView*, SVEventType> const, std::pair<SVSemaphore*, SVEvent*> > > >::erase(std::_Rb_tree_iterator<std::pair<std::pair<ScrollView*, SVEventType> const, std::pair<SVSemaphore*, SVEvent*> > >) in libtesseract_full.a(libtesseract_full.o) 
    "std::string::length() const", referenced from: 
     SVNetwork::Flush() in libtesseract_full.a(libtesseract_full.o) 
    "std::string::operator+=(char)", referenced from: 
     ScrollView::SendPolygon() in libtesseract_full.a(libtesseract_full.o) 
    "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()", referenced from: 
     ScrollView::SendPolygon() in libtesseract_full.a(libtesseract_full.o) 
     SVNetwork::SVNetwork(char const*, int) in libtesseract_full.a(libtesseract_full.o) 
    "std::_Rb_tree_increment(std::_Rb_tree_node_base*)", referenced from: 
     std::_Rb_tree_iterator<std::pair<int const, VariableContent*> >::operator++() in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree_iterator<std::pair<char const* const, int> >::operator++() in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree_iterator<std::pair<int const, ScrollView*> >::operator++() in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree_iterator<std::pair<std::pair<ScrollView*, SVEventType> const, std::pair<SVSemaphore*, SVEvent*> > >::operator++() in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree_iterator<std::pair<int const, ScrollView*> >::operator++(int) in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree_iterator<std::pair<std::pair<ScrollView*, SVEventType> const, std::pair<SVSemaphore*, SVEvent*> > >::operator++(int) in libtesseract_full.a(libtesseract_full.o) 
    "std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from: 
     std::_Rb_tree<int, std::pair<int const, VariableContent*>, std::_Select1st<std::pair<int const, VariableContent*> >, std::less<int>, std::allocator<std::pair<int const, VariableContent*> > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<int const, VariableContent*> const&) in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree<char const*, std::pair<char const* const, int>, std::_Select1st<std::pair<char const* const, int> >, std::less<char const*>, std::allocator<std::pair<char const* const, int> > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<char const* const, int> const&) in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree<int, std::pair<int const, ScrollView*>, std::_Select1st<std::pair<int const, ScrollView*> >, std::less<int>, std::allocator<std::pair<int const, ScrollView*> > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<int const, ScrollView*> const&) in libtesseract_full.a(libtesseract_full.o) 
     std::_Rb_tree<std::pair<ScrollView*, SVEventType>, std::pair<std::pair<ScrollView*, SVEventType> const, std::pair<SVSemaphore*, SVEvent*> >, std::_Select1st<std::pair<std::pair<ScrollView*, SVEventType> const, std::pair<SVSemaphore*, SVEvent*> > >, std::less<std::pair<ScrollView*, SVEventType> >, std::allocator<std::pair<std::pair<ScrollView*, SVEventType> const, std::pair<SVSemaphore*, SVEvent*> > > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<std::pair<ScrollView*, SVEventType> const, std::pair<SVSemaphore*, SVEvent*> > const&) in libtesseract_full.a(libtesseract_full.o) 
    "std::ios_base::Init::~Init()", referenced from: 
     ___tcf_0 in libtesseract_full.a(libtesseract_full.o) 
     ___tcf_0 in libtesseract_full.a(libtesseract_full.o) 
    "std::string::c_str() const", referenced from: 
     ScrollView::SendPolygon() in libtesseract_full.a(libtesseract_full.o) 
     SVNetwork::Flush() in libtesseract_full.a(libtesseract_full.o) 
    "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()", referenced from: 
     ScrollView::SendPolygon() in libtesseract_full.a(libtesseract_full.o) 
     SVNetwork::SVNetwork(char const*, int) in libtesseract_full.a(libtesseract_full.o) 
    "std::string::append(char const*)", referenced from: 
     SVNetwork::Send(char const*) in libtesseract_full.a(libtesseract_full.o) 
    "std::cout", referenced from: 
     SVNetwork::SVNetwork(char const*, int) in libtesseract_full.a(libtesseract_full.o) 
ld: symbol(s) not found for architecture armv7 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

Любая помощь будет оценена по достоинству.

+0

C++ стандартная библиотека не связана с. – 2013-02-13 14:33:27

+0

Как это сделать? – Saurabh

+0

Я добавил «-stdC++» и «-ObjC» в другой флаг компоновщика. – Saurabh

ответ

20

только что изменил «Стандартную библиотеку C++» в настройках сборки на «libstdC++ (стандартная библиотека GNU C++)» и ошибки исчезли ... Спасибо @ H2CO3 за подсказку.

+0

См. Http://stackoverflow.com/questions/12665457/zxing-in-xcode-4-5-and-ios-6 – Till

+0

+1 помогли много .. – Praveenkumar

+0

Спасибо много, для одного решения гильзы –

1

Есть несколько вопросов:

Во-первых, убедитесь, что файл, содержащий код:

tess = new TessBaseAPI(); 
tess->SimpleInit(...); 

имеет расширение файла .mm (Objective-C++), поскольку он использует как Objective-C и C++.

Во-вторых, библиотека выглядит он не был скомпилирован для armv7, так что вам нужно будет восстановить его для любых архитектур, которые вы хотите поддержать, который будет представлять собой один или несколько из armv6, armv7, armv7s и i386 (для iPhone Simulator).

Если вы ориентируетесь на iOS 5.0+, то это будет все вышеперечисленное, кроме armv6, которое не поддерживается в более поздних версиях Xcode.

В-третьих, убедитесь, что вы используете ту же версию библиотеки C++ и C++ как в библиотеке, так и в приложении, иначе будут плохие вещи.

+0

просто изменил« Стандартную библиотеку C++ »в настройках сборки на« libstdC++ (GNU) Стандартная библиотека C++), и ошибки исчезли ... Спасибо @ H2CO3 – Saurabh

0

Убедитесь, что:

C++ Язык Диалект Set "Compiler Default" вместо "GNU ++ 11 [-std = гну ++ 11]"

C++ Стандартная библиотека Set "Compiler Default" вместо "LibC++ (LLVM C++ стандартная библиотека с поддержкой C++ 11)"

Также проверьте:

C диалектного языка Set "С00 [-std = c99]" вместо "GNU00 [-std = gnu99]"

и файлы tesseract должны быть указаны правильно.(Перетащить файлы не ссылаться правильно)

+0

Это все равно не работает. –

0
ld: -weak_library and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
  1. Изменение проекта -> Project -> Build Settings -> ** "Включить" битового кода для NO

  2. также удалить все компоновщика флаги «связь» -> «Другие флаги компоновщика» и добавьте

Linker Flags 3. После этого установить стручки по команде «Стручок установить»

работы Это для меня на Swift 2 и Xcode 7.2 (бета)

Смежные вопросы