c++ 编译error
error1:
因为在py脚本里调用动态链接库.so文件(Linux)或者.dll文件(windows)
xxx_lib.so: invalid ELF header 所以需要重新编译一下
lib = ctypes.cdll.LoadLibrary(libfile)
重新编译
g++ xxx.cpp -fPIC -shared -o xxx_lib.so
error2:
缺少引用
km_dict.cpp:67:24: error: ‘sqrt’ was not declared in this scope67 | inv_sq = 1/sqrt(sum_sq); // divide by sum of squares| ^~~~
km_dict.cpp: In function ‘std::vector<int> randperm(int, int)’:
km_dict.cpp:95:14: error: ‘LONG_MAX’ was not declared in this scope95 | if ( LONG_MAX > RAND_MAX && n-i-1>RAND_MAX ){ // not enough with a random integer up til RAND_MAX| ^~~~~~~~
km_dict.cpp:15:1: note: ‘LONG_MAX’ is defined in header ‘<climits>’; did you forget to ‘#include <climits>’?14 | #include <iostream>+++ |+#include <climits>15 | using namespace std;
km_dict.cpp: In function ‘void build_km_tree(im_st&, tree_st&, int, bool)’:
km_dict.cpp:253:29: error: ‘log’ was not declared in this scope; did you mean ‘long’?253 | int n_layer = (int)ceil(log((double)tree.n_nodes)/log((double)tree.branch_fac)); // number of layers in the tree| ^~~| long
km_dict.cpp:253:24: error: ‘ceil’ was not declared in this scope253 | int n_layer = (int)ceil(log((double)tree.n_nodes)/log((double)tree.branch_fac)); // number of layers in the tree| ^~~~
km_dict.cpp:262:27: error: ‘pow’ was not declared in this scope262 | n_in_layer = (int)pow((double)tree.branch_fac,i); // number of nodes in current layer of the tree| ^~~
km_dict.cpp:263:9: error: ‘sort’ was not declared in this scope; did you mean ‘qsort’?263 | sort(patches.begin(), patches.end()); // sort the patches according to their current id| ^~~~| qsort
km_dict.cpp: In function ‘void build_km_tree(const double*, int, int, int, int, int, int, int, bool, double*)’:
km_dict.cpp:313:23: error: ‘pow’ was not declared in this scope313 | n_tmp += (int)pow((double)branch_fac,(i+1));| ^~~
km_dict.cpp: In function ‘void prob_im_to_dict(const int*, int, int, const double*, int, int, int, double*)’:
km_dict.cpp:496:19: error: ‘floor’ was not declared in this scope496 | int patch_h = floor( patch_size / 2 );| ^~~~~
km_dict.cpp: In function ‘void dict_to_prob_im_opt(const int*, int, int, const double*, int, int, double*)’:
km_dict.cpp:562:19: error: ‘floor’ was not declared in this scope562 | int patch_h = floor( patch_size / 2 ); // half patch size minus 0.5| ^~~~~
km_dict.cpp: In function ‘void dict_to_prob_im(const int*, int, int, const double*, int, int, double*)’:
km_dict.cpp:639:19: error: ‘floor’ was not declared in this scope639 | int patch_h = floor( patch_size / 2 );| ^~~~~
km_dict.cpp: In function ‘void im_to_assignment(const double*, int, int, const double*, int, int, int*)’:
km_dict.cpp:728:19: error: ‘floor’ was not declared in this scope728 | int patch_h = floor( patch_size / 2 ); // half patch size minus 0.5
加入引用
#include <climits>
#include <cmath>
#include<algorithm>
python调用c++接口类型
https://www.cnblogs.com/traditional/p/12243307.html
c++ 编译error相关推荐
- VScode C++ 编译error:‘XXX‘ was not declared in this scope, template argument 1 is invalid解决方法
文章目录 VScode C++ 编译error 一.报错信息: 二.文件结构: 三.问题分析 四.问题解决 方法一:去掉多余的含入 方法二:使用前置声明 VScode C++ 编译error 一.报错 ...
- 转:delphi dpk编译 Error: E2161 RLINK32: Unsupported 16bit resource in file xxx 问题解决
[问题解决]delphi dpk编译 Error: E2161 RLINK32: Unsupported 16bit resource in file xxx 问题解决 原创 2013年08月27日 ...
- ubuntu16.04 cuda8.0 caffe 编译 error: cublas_v2.h 没有那个文件或目录
ubuntu16.04 cuda8.0 caffe 编译时遇到 caffe fatal error: cublas_v2.h 没有那个文件或目录 参考:http://blog.csdn.net/qq_ ...
- android编译error, forbidden warning出错问题解决
android编译Kernel时,从高版本GCC起,就开始把warning作为error对待,比如我们遇到: gsl3670.c:2065:21: warning: unused variable ' ...
- OpenCV3.4.5带GPU编译error: #error This file requires compiler and library support for the ISO C++ 2011
error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This su ...
- C/C++中预编译#,##,#error作用
From: http://bluefairy218.blog.163.com/blog/static/313917532008456397524/ #是生成字符串: #define ...
- AD原理图编译ERROR:GND contains Output Pin and Power Pin objects
Altium designer ERROR系列: ERROR:GND contains Output Pin and Power Pin objects ERROR:Net GND countains ...
- DveC++编译[Error] ld returned 1 exit status
//prog1.c #include <stdio.h> #include "prog2.c" extern void f2(); void f1(); int a; ...
- GCC 9.4 编译error: catching polymorphic type ‘class std::bad_alloc’ by value [-Werror=catch-value=]
环境 lm@lm:~$ cat /etc/os-release NAME="Ubuntu" VERSION="20.04.4 LTS (Focal Fossa)" ...
最新文章
- php设置backlog,高并发调优backlog多大合适?
- Nginx Http认证 实现访问网站或目录密码认证保护
- Java 安装后的检测是否安装成功
- A13在c语言中是合法变量吗,C语言中局部变量和全局变量等在内存中的存放位置.doc-资源下载在线文库www.lddoc.cn...
- linux提升网络实时性,通过调整Linux内核参数提升网络性能
- PHP使用session_set_save_handler陷阱
- php获取蓝凑云文件列表,php调用蓝奏云下载接口
- php字符串中单引号与双引号的区别,简单概括PHP的字符串中单引号与双引号的区别...
- MySQL 修改和删除触发器
- python实现希尔排序算法_排序算法总结(冒泡排序、直接插入排序、希尔排序)(python实现)...
- 【Java】用随机数打印hello world
- Windows Server 2012安装 .NET Framework 3.5
- 专访Facebook HipHop作者、阿里研究员赵海平:生物与计算机交织的独特人生
- 巧用头条号及悟空问答引流
- iOS表格,Sheets.framework
- 解决win10系统搜索框无法使用
- 用ddddocr识别图形字符验证码
- [zoj 3587]Marlon's String[kmp]
- 【面试攻略】服务端面试-边锋
- 那些年搭建风控体系所踩的坑