Hello My Friend

I don't know how did you manage your CMakeLists.txt file and your build
system, so it should be related to many things, from Visual Studio version,
to debug and release versions of your build ... but specifically about
building Qt5 related UIs with *.mll *plugins of maya ( I did it
experimentally years ago) and for finding Qt related cmake config, you
should be able to build your tool successfully if you have these:

- In your CmakeLists.txt you should have these settings
include($ENV{DEVKIT_LOCATION}/cmake/pluginEntry.cmake)
$ENV{DEVKIT_LOCATION}: is my Env Variable of the Maya SDKS root location
You should enable these settings for Qt:
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

After adding your Source files and Maya Libraries
# set SOURCE_FILES
set(SOURCE_FILES
    myPlugin.cpp
    main.cpp
)

# set linking libraries
set(LIBRARIES
     OpenMaya
     Foundation
)

You should add codes like this:
# Build plugin
build_plugin() # this will be find in maya sdk cmake config file

find_package(Qt5 COMPONENTS Core Widgets Gui OpenGL REQUIRED)
target_link_libraries($ENV{TARGET_NAME} Qt5::Core Qt5::Widgets Qt5::Gui
Qt5::OpenGL)
$ENV{TARGET_NAME}: you can set TARGET_NAME or PROJECT_NAME as your plugin
name
- I recommend to build your project through cmake with:

cd build
cmake -G "Visual Studio 17 2022" -A x64 ..

- It seems you are using GL/gl.h that I'm not sure it is related to Maya or
QT, but for OpenGL try to add this line to your CMakeLists.txt too
find_package(OpenGL REQUIRED)
Then open .sln file inside Visual Studio and build it in Debug and release
mode and see the difference!
I hope it helps you, if you have more Questions, please provide more data
like your CMakeLists.txt or build.bat file We can help more



On Tue, Nov 7, 2023 at 10:00 AM Andrew Golubev <golube...@gmail.com> wrote:

> Yeah, I downloaded the devkit, extracted it and linked all included QT
> Libs.
> I will have a look with DependencyWalker; it may be more apparent with
> which exact dll is missing; thank you!
> It seems that overall, QT is working there, but when I override some
> OpenGL functions, I have this error.
> On Tuesday, 7 November 2023 at 15:22:02 UTC Marcus Ottosson wrote:
>
>> This rings a bell, but it's too late in the day to hear which one. Are
>> you linking with QtCore and relevant Qt binaries?
>>
>> There's this neat tool you can try, which lists relevant dependencies of
>> a binary, including a Maya .mll
>>
>> - https://dependencywalker.com/
>>
>> [image: Screenshot 2023-11-07 152019.jpg]
>>
>> On Tuesday, 7 November 2023 at 15:09:16 UTC golu...@gmail.com wrote:
>>
>>> 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)
>>> ; };
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/9e1a9f52-abaf-4f9d-86b1-e1ed43c7ac2fn%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/9e1a9f52-abaf-4f9d-86b1-e1ed43c7ac2fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 


---------------------
*--= Reza Aarabi =--*
*https://madoodia.com <https://madoodia.com>*

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CADvbQwJLFGdr7rn_uLtLGM_avZduUpswTEiisUkH2RpdZk7L3Q%40mail.gmail.com.

Reply via email to