zoukankan      html  css  js  c++  java
  • Learning part-based templates from large collections of 3D shapse CorrsTmplt Kim 代码调试

    平台: VMware上装的Ubuntu-15.10

    环境准备工作:装Fortran, lapack, blas, cblas (理论上装好lapack后面两个应该是自动的),其他的有需要的随时安装就可以

    =====  开始编译 =====

    cd到CorrsTmplt的目录

    1. sleep的error

    在命令行执行

    make

    此时,出现error

    FileManagement.cpp:25:25: error: ‘sleep’ was not declared in this scope
    sleep(checkEveySeconds);

    解决方案:在FileManagement.cpp文件的引用中加入

    #include <unistd.h>

    保存后再次 make

    出现类似的错误:

    LinAlg.cpp:41:25: error: ‘sleep’ was not declared in this scope
    sleep(checkEveySeconds);

    道理是一样的,找到LinAlg.cpp文件,在引用中加入

    #include <unistd.h> 

    保存后再次make

    2. stderr,fprintf was not declared

    这次make后出现了新的错误:

    LinAlgMatrixComplex.cpp:340:11: error: ‘stderr’ was not declared in this scope
    fprintf(stderr, "[ERROR] Error solving system of equations: %d ", info);

    这个也不难,找到LinAlgMatrixComplex.cpp文件,在引用中加入

    #include <stdio.h>

     保存后,make

    3. NULL was not declared

    make后出现新的错误:

    VKGraph.h:60:51: error: ‘NULL’ was not declared in this scope

    找到VKGraph.h,在引用中加入

    #include <cstdlib>

    保存后,继续make

    4. fopen, fwrite... was not declared in this scope

    make后出现了新的error,好开心哦~! 

    Clustering.cpp:118:36: error: ‘fopen’ was not declared in this scope

    找到Clustering.cpp, 在引用中加入

    #include <stdio.h>

    保存后,接着make

    (不是在make就是在走向make的路上,且make且珍惜。。。)


    5. 找不到类型

    make后出现如下error

    GCoptimization.h:389:16: error: ‘ptrdiff_t’ does not name a type

    找到GCoptimization.h,在引用部分(不是文件头部哦,在靠近中间的地方)加入

    #include <cstddef>

    保存后,继续make

    6. add_edge, add_tweights was not declared in this scope

    当然不会这么简单让你make成功啦~~这次又出现了长成下面这个样子的一系列error:

    energy.h:220:14: error: ‘add_tweights’ was not declared in this scope

    不要怕!打开energy.h

    把所有的 add_edge 都替换成 this->add_edge

    把所有的 add_tweights 都替换成 this->add_tweights

    注意,已经有this->就不要再加了哦~

    保存后,make

    又来error

    energy.h:328:89: error: ‘what_segment’ was not declared in this scope

    哦,有漏网之鱼啊,找到这一行,在what_segment前面加上this-> 变成this->what_segment

    保存,继续make吧~~

    7.  redeclaration

    新的error

    VisModel3D.cpp:378:7: error: redeclaration of ‘int matID’

    这个简单,找到那一行,注释掉就行

    保存,继续make

    8. redeclaration

    出现error:

    VisShapeTemplateDraw.cpp:594:12: error: redeclaration of ‘R3Point p’

    找到这个文件的594行,

    原来是长这样:

    R3Point p = pnts->PointPosition(gid);
                
    model2cam.Apply(tpnt);
    model2cam.Apply(p);
                
    glColor3d(.2, .2, .2);
    glVertex3d(p.X(), p.Y(), p.Z());
    glColor3d(.2, 1., .2);
    glVertex3d(tpnt.X(), tpnt.Y(), tpnt.Z());
    edges.push_back(tpnt);
    edges.push_back(p);

    把p替换成point,修改后长这样:

    R3Point point = pnts->PointPosition(gid);
                
    model2cam.Apply(tpnt);
    model2cam.Apply(point);
                
    glColor3d(.2, .2, .2);
    glVertex3d(point.X(), point.Y(), point.Z());
    glColor3d(.2, 1., .2);
    glVertex3d(tpnt.X(), tpnt.Y(), tpnt.Z());
    edges.push_back(tpnt);
    edges.push_back(point);

    注意,594行之前的p不要替换哦~

    保存后,接着make

    9. 各种undefined references to ...

    这时候似乎出现了逆天的bug...前方一大波undefined reference to...向我走来,伦家好害怕!!

    这个error可能长这样:

    ShapePointCloud.cpp:(.text+0xfc9): undefined reference to `R3Vector::Length() const'

    实际上会有更多的这个link error,仔细观察一下,发现这些link error都是发生在对R3***或者相关的引用上面。

    R3***在什么地方呢?找一下,发现它们在/external/gaps/pkgs 中,由于某种不可知的原因,这些东西似乎木有编译成功。。

    阅读一下gaps目录下的README.txt,上面告诉我们可以在这个目录下进行一下make。试一下~~

    cd 到 CorrsTmplt/external/gaps ,先后执行:

    make clean

    make

    再回到CorrsTmplt目录下,make一下

    到这里,编译就已经结束了……那是不可能滴。

    革命尚未成功。。。继续

    10. error: expected type-specifier

    保证这是最后一个error哈~~

    这次make后那一大堆莫名其妙的undefined reference已经没有了,但是出现了下面的error

    EvalCorrs.cpp:113:27: error: expected type-specifier

    EvalCorrs.cpp:340:27: error: expected type-specifier

    你以为这样就会击垮我吗?Naive~~

    打开EvalCorrs.cpp,找到113行和340行

    ModelDatabase * db = new ModelDatabase::ModelDatabase();

    替换成

    ModelDatabase * db = new ModelDatabase();

    保存,make

    yeah~~~居然没有error了??哈哈,这样整个编译就结束啦~~

    打开CorrsTmplt/bin/x86_64,可以看到9个可执行文件,说明编译成功啦。

    下一步就是要怎么使用这份源码了,会用了再来写~!

  • 相关阅读:
    ThreadLocal内存泄漏真因探究(转)
    JAVA设计模式工厂模式
    java设计模式单例模式
    Java-Socket
    Java-Queue总结
    Java-Reentrantlock
    Java-Iterator遍历集合
    安装和启动docker
    C# System.Reflection.Assembly动态加载资源文件
    C#调用 kernel32.dll
  • 原文地址:https://www.cnblogs.com/zhsuiy/p/5110403.html
Copyright © 2011-2022 走看看