About ccPointCloud problem.

Any question about the main GUI application (frontend)
Post Reply
wayneliu0512
Posts: 5
Joined: Thu Jul 12, 2018 9:28 am

About ccPointCloud problem.

Post by wayneliu0512 »

I try to create a GLWindow, and a ccPointCloud object, and something going wrong.
I got an error from the linker, here is my code and error below.

Image

untitled1.pro

Code: Select all

#-------------------------------------------------
#
# Project created by QtCreator 2018-07-03T14:01:18
#
#-------------------------------------------------

QT       += core gui opengl openglextensions

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = untitled1
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0


SOURCES += \
        main.cpp

HEADERS +=

FORMS += \

win32:CONFIG(release, debug|release): LIBS += -LD:/CloudCompare-2.9.1/build_v2/libs/qCC_db/release/ -lQCC_DB_LIB \
                                              -LD:/CloudCompare-2.9.1/build_v2/CC/release/ -lCC_CORE_LIB \
                                              -LD:/CloudCompare-2.9.1/build_v2/libs/qCC_io/release/ -lQCC_IO_LIB \
                                              -LD:/CloudCompare-2.9.1/build_v2/libs/qCC_glWindow/release/ -lQCC_GL_LIB \
                                              -LD:/CloudCompare-2.9.1/build_v2/libs/CCFbo/release/ -lCC_FBO_LIB \
                                              -L$$PWD/../../../../../dev/CGAL-4.12/auxiliary/gmp/lib/ -llibgmp-10 \
                                              -L$$PWD/../../../../../dev/CGAL-4.12/auxiliary/gmp/lib/ -llibmpfr-4 \

else:win32:CONFIG(debug, debug|release): LIBS += -LD:/CloudCompare-2.9.1/build_v2/CC/debug/ -lCC_CORE_LIBd \
                                                 -LD:/CloudCompare-2.9.1/build_v2/libs/qCC_io/debug/ -lQCC_IO_LIBd \
                                                 -LD:/CloudCompare-2.9.1/build_v2/libs/qCC_glWindow/debug/ -lQCC_GL_LIBd \
                                                 -LD:/CloudCompare-2.9.1/build_v2/libs/CCFbo/debug/ -lCC_FBO_LIBd \
                                                 -LD:/CloudCompare-2.9.1/build_v2/libs/qCC_db/debug/ -lQCC_DB_LIBd \
                                                 -L$$PWD/../../../../../dev/CGAL-4.12/auxiliary/gmp/lib/ -llibgmp-10 \
                                                 -L$$PWD/../../../../../dev/CGAL-4.12/auxiliary/gmp/lib/ -llibmpfr-4 \

INCLUDEPATH +=  D:/CloudCompare-2.9.1/CC/include \
               D:/CloudCompare-2.9.1/libs/CCFbo/include \
               D:/CloudCompare-2.9.1/libs/qCC_glWindow \
               D:/CloudCompare-2.9.1/libs/qCC_io \
               D:/CloudCompare-2.9.1/libs/qCC_db \
               $$PWD/../../../../../dev/CGAL-4.12/auxiliary/gmp/include \

DEPENDPATH +=  D:/CloudCompare-2.9.1/CC/include  \
              D:/CloudCompare-2.9.1/libs/CCFbo/include \
              D:/CloudCompare-2.9.1/libs/qCC_glWindow \
              D:/CloudCompare-2.9.1/libs/qCC_io \
              D:/CloudCompare-2.9.1/libs/qCC_db \
              $$PWD/../../../../../dev/CGAL-4.12/auxiliary/gmp/include \
main.cpp

Code: Select all

#include <QApplication>
#include <ccPointCloud.h>
#include <ccGLWidget.h>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    ccGLWindow *m_window = 0;
    QWidget* m_widget = 0;
    CreateGLWindow(m_window, m_widget);
    m_widget->show();

    ccPointCloud points;

    return a.exec();
}
After many times of try and error, I find something wired.
When I declared the ccPointCloud object as a pointer, errors would disappear.

like this

Code: Select all

#include <QApplication>
#include <ccPointCloud.h>
#include <ccGLWidget.h>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    ccGLWindow *m_window = 0;
    QWidget* m_widget = 0;
    CreateGLWindow(m_window, m_widget);

    m_widget->show();

    ccPointCloud *points = new ccPointCloud;

    return a.exec();
}
Is there anyone understand what is this situation? and why?
Please help me~
Thank you.
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: About ccPointCloud problem.

Post by daniel »

I totally missed this message, sorry.

This was maybe due to an heritage issue that was causing a bug with new compilers (Visual 2015 and later, etc.). This is fixed now.
Daniel, CloudCompare admin
wayneliu0512
Posts: 5
Joined: Thu Jul 12, 2018 9:28 am

Re: About ccPointCloud problem.

Post by wayneliu0512 »

Thanks for your reply, Daniel.

I tried to rebuild the newest version of cloudcompare, but I still got the same problem.

My kit version:

Code: Select all

Qt 5.10.1 MSVC2017 64bit
Is there something wrong, or something I missed?
Should I use the particular version of Qt or MSVC?
Thank you~
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: About ccPointCloud problem.

Post by daniel »

Hum, I haven't tried with Qt 5.10 (I'm still at 5.9) but I don't believe this is the cause of the issue...

Do you really have the latest version with the templated version of CCLib::PointCloud? (PointCloudTpl)
Daniel, CloudCompare admin
wayneliu0512
Posts: 5
Joined: Thu Jul 12, 2018 9:28 am

Re: About ccPointCloud problem.

Post by wayneliu0512 »

Is this the latest version of PointCloud?
Image
I try this version of CC library but still got the same error.
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: About ccPointCloud problem.

Post by daniel »

Yes indeed... It's strange that you still have this issue. Are you able to start this code in debug mode (should be the default in Visual Studio) and check where (and why) it crashes exactly?
Daniel, CloudCompare admin
wayneliu0512
Posts: 5
Joined: Thu Jul 12, 2018 9:28 am

Re: About ccPointCloud problem.

Post by wayneliu0512 »

Actually, I also want to start this code in debug mode.
But, unfortunately, this is a link time error, so I can't even build this code successfully.
Image

Maybe you could try to build my code, You may find more clues.
I am very appreciated for your help.
Attachments
test_ccLib.zip
(406.77 KiB) Downloaded 715 times
wayneliu0512
Posts: 5
Joined: Thu Jul 12, 2018 9:28 am

Re: About ccPointCloud problem.

Post by wayneliu0512 »

Sorry, you should try this version (ccPointCloud is not a pointer)
Attachments
test_ccLib.zip
(409.22 KiB) Downloaded 732 times
Post Reply