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

opencv3.2 编译报错解决 #152

Closed
jjz opened this issue Dec 5, 2016 · 13 comments
Closed

opencv3.2 编译报错解决 #152

jjz opened this issue Dec 5, 2016 · 13 comments
Labels

Comments

@jjz
Copy link

jjz commented Dec 5, 2016

expected '(' for function-style cast or type construction. (check one with "chars_identify.cpp")

[ 25%] Building CXX object CMakeFiles/easypr.dir/src/core/chars_identify.cpp.o
.../c/EasyPR/src/core/chars_identify.cpp:20:41: error: expected '(' for function-style cast or type construction
    ann_ = ml::ANN_MLP::load<ml::ANN_MLP>(kDefaultAnnPath);
                             ~~~~~~~~~~~^
.../c/EasyPR/src/core/chars_identify.cpp:21:48: error: expected '(' for function-style cast or type construction
    annChinese_ = ml::ANN_MLP::load<ml::ANN_MLP>(kChineseAnnPath);
                                    ~~~~~~~~~~~^
.../c/EasyPR/src/core/chars_identify.cpp:32:43: error: expected '(' for function-style cast or type construction
      ann_ = ml::ANN_MLP::load<ml::ANN_MLP>(path);
                               ~~~~~~~~~~~^
.../c/EasyPR/src/core/chars_identify.cpp:42:50: error: expected '(' for function-style cast or type construction
      annChinese_ = ml::ANN_MLP::load<ml::ANN_MLP>(path);
                                      ~~~~~~~~~~~^
4 errors generated.
make[2]: *** [CMakeFiles/easypr.dir/src/core/chars_identify.cpp.o] Error 1
make[1]: *** [CMakeFiles/easypr.dir/all] Error 2
make: *** [all] Error 2

Please tell us about your environment:

  • System: Macos

  • Compiler version/IDE: gcc4.2.1

  • CMake version: 3.7.1

  • OpenCV version: 3.1

@czy
Copy link

czy commented Dec 29, 2016

编译通过了,做了如下修改:
chars_identify.cpp
load去掉<ml::ANN_MLP>
plate_judge.cpp
load去掉<ml::SVM>
svm_train.cpp
load去掉<cv::ml::SVM>

  • System: macOS 10.12.1
  • Compiler version/IDE: Apple LLVM version 8.0.0
  • CMake version: 3.7.1
  • OpenCV version: 3.2

@jason0539
Copy link

@rocLv
Copy link

rocLv commented Feb 9, 2017

确实有效,赞!

@liuruoze liuruoze changed the title MacOS上面编译报错 opencv3.2 编译报错解决 Feb 10, 2017
@liuruoze
Copy link
Owner

已修改标题,帮助更多人看到后得知解决方案。

@498143049
Copy link

自己不太懂这个,但是 为什么 这样改就是可以的呢?

@B-one
Copy link

B-one commented Mar 20, 2017

错误 143 error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MD_DynamicRelease”不匹配值“MT_StaticRelease”(main.obj 中) E:\OpenCV\EasyPR-master\vcprojs\libeasypr.lib(plate_detect.obj) demo

@B-one
Copy link

B-one commented Mar 20, 2017

环境为vs2013,openCV3.2,在进行release编译时出现这种情况,debug编译已经通过。

@liuruoze
Copy link
Owner

release版对应的opencv的库需要调整的

@liuruoze liuruoze mentioned this issue Mar 20, 2017
@itriphaxer
Copy link

error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”

在工程上右键-》属性-》c/c++-》代码生成-》运行库
改成(release为MD,debug为MDd)即可解决

@ZhangXinNan
Copy link
Contributor

ZhangXinNan commented Jul 2, 2017

Opencv3.2版本的支持,编译前仅需要将config.h中将#define CV_VERSION_THREE_ZERO改为#define CV_VERSION_THREE_TWO即可。

/include/easypr/config.h
-#define CV_VERSION_THREE_ZERO
+// #define CV_VERSION_THREE_ZERO
+#define CV_VERSION_THREE_TWO

@iamblue
Copy link

iamblue commented Jul 17, 2017

@ZhangXinNan thank you ! fixed it!

@Lucas-Yang
Copy link

@ZhangXinNan +1 fixed it

lzufalcon added a commit to lzufalcon/EasyPR that referenced this issue Jun 10, 2018
Fix up errors like liuruoze#152

EasyPR/src/core/chars_identify.cpp:22:3: error: expected '(' for function-style cast or type construction
  LOAD_ANN_MODEL(ann_, kDefaultAnnPath);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EasyPR/include/easypr/config.h:141:42: note: expanded from macro 'LOAD_ANN_MODEL'
    model = ml::ANN_MLP::load<ml::ANN_MLP>(path);
                              ~~~~~~~~~~~^

Tested in Mac OSX with opencv 3.4.1.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
@lzufalcon
Copy link

通过自动判断OpenCV版本号彻底解决该问题:#286

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

No branches or pull requests