Maya C++ OpenGL linker issues

Maya C++ OpenGL linker issues

golubevcg
Explorer Explorer
822 Views
1 Reply
Message 1 of 2

Maya C++ OpenGL linker issues

golubevcg
Explorer
Explorer

Hey everyone!
I hope you are all doing well)

I wanted to ask a question about Maya C++ plugin building. I'm currently struggling with an issue I can't resolve for a couple of days.

I created a custom context with manips, and it is working and building very well, but at some point, I needed to create a small QDialog with QT libraries, which uses OpenGL, and this is my main issue. I downloaded Maya Devkit, added a linker and include libs.

I also tried to use FindMaya_Qt.cmake from the Autodesk USD repository. But I can't go over a linker error, which appears during compilation.It seems to me that some DLLs or libraries are missing, but I don't get which one. Maybe someone had a similar issue?

I also tried to add opengl32.dll but it doesn't do nothing. It seems to me that something is wrong with my Qt config, or cpp class which uses OpenGL.

 

Here is my errors from Visual studio:

Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol __imp_glViewport referenced in function "protected: virtual void __cdecl DebugRenderer::resizeGL(int,int)" (?resizeGL@DebugRenderer@@MEAAXHH@Z) maya_plugin C:\Users\golub\Documents\maya_plugin\build\src\debugDialog.obj 1

Error LNK2019 unresolved external symbol __imp_glBegin referenced in function "protected: virtual void __cdecl DebugRenderer::paintGL(void)" (?paintGL@DebugRenderer@@MEAAXXZ) maya_plugin C:\Users\golub\Documents\maya_plugin\build\src\debugDialog.obj 1

Error LNK2019 unresolved external symbol __imp_glClear referenced in function "protected: virtual void __cdecl DebugRenderer::paintGL(void)" (?paintGL@DebugRenderer@@MEAAXXZ) maya_plugin C:\Users\golub\Documents\maya_plugin\build\src\debugDialog.obj 1

Error LNK2019 unresolved external symbol __imp_glClearColor referenced in function "protected: virtual void __cdecl DebugRenderer::initializeGL(void)" (?initializeGL@DebugRenderer@@MEAAXXZ) maya_plugin C:\Users\golub\Documents\maya_plugin\build\src\debugDialog.obj 1

Error LNK2019 unresolved external symbol __imp_glColor3f referenced in function "protected: virtual void __cdecl DebugRenderer::paintGL(void)" (?paintGL@DebugRenderer@@MEAAXXZ) maya_plugin C:\Users\golub\Documents\maya_plugin\build\src\debugDialog.obj 1

Error LNK2019 unresolved external symbol __imp_glEnd referenced in function "protected: virtual void __cdecl DebugRenderer::paintGL(void)" (?paintGL@DebugRenderer@@MEAAXXZ) maya_plugin C:\Users\golub\Documents\maya_plugin\build\src\debugDialog.obj 1

Error LNK2019 unresolved external symbol __imp_glVertex3f referenced in function "protected: virtual void __cdecl DebugRenderer::paintGL(void)" (?paintGL@DebugRenderer@@MEAAXXZ) maya_plugin C:\Users\golub\Documents\maya_plugin\build\src\debugDialog.obj 1

 

And also, class which gives me an error:

#pragma once

#include <reactphysics3d/reactphysics3d.h>
#include <maya/MQtUtil.h>
#include <QtWidgets/qdialog.h>
#include <QtWidgets/QVBoxLayout>
#include <QtOpenGL/qglfunctions.h>
#include <QtGui/QOpenGLFunctions>
#include <QtWidgets/QOpenGLWidget>
#include <GL/gl.h>
#include <QtGui/qopenglext.h>


class DebugRenderer : public QOpenGLWidget, protected QOpenGLFunctions {  // Updated inheritance
public:
    DebugRenderer(rp3d::PhysicsWorld* physicsWorld, QWidget* parent = nullptr);

protected:
    void initializeGL() override;
    void resizeGL(int w, int h) override;
    void paintGL() override;

private:
    rp3d::PhysicsWorld* physicsWorld;
};

class DebugDialog : public QDialog {
public:
    DebugDialog(rp3d::PhysicsWorld* physicsWorld, QWidget* parent = nullptr);
};

 

Accepted solutions (1)
823 Views
1 Reply
Reply (1)
Message 2 of 2

golubevcg
Explorer
Explorer
Accepted solution

Small update about this issue - I was able to resolve it with help from others.

After I added this cmake into my build:
include($ENV{DEVKIT_LOCATION}/cmake/pluginEntry.cmake)

And launched function, which is stored inside this cmake:
build_plugin()

It fetched some additional dependencies, and I could build & compile it correctly.

0 Likes