Closed zhouxs1023 closed 3 years ago
Well, I'm on Linux and I can't help much.
For sprintf
you should include#include <stdio.h>
(also see here). However sprintf
is only present in the piece of code you posted: you probably don't need it if you remove the for loop and use hard-coded dock names.
For all the other errors, you should #include "addons/imguidock/imguidock.h"
and add addons/imguidock/imguidock.cpp
to your source files.
That should work, because you're simply adding imguidock.h
and imguidock.cpp
to a "regular" Dear ImGui project (without using any imgui_addon binding).
P.S. I've edited your post a bit, adding some corrections and formatting.
Closing this.
I had done what you say,Copy imguidock.cpp and imguidock.h to the project, it can be compiled successfully, but exe file cannot run. The error as follows
There should be no definition of dockcontext, but I don't know how to define it,hope your help!
Yes, this is probably caused by this pull request https://github.com/Flix01/imgui/pull/43. But if you read imguidock.h a bit more, you can find this:
// Create, destroy and change dock contexts (*).
// EXAMPLE USAGE:
/* ImGui::DockContext* myDockContext=NULL; // global variable
// When you init your application:
myDockContext = ImGui::CreateDockContext();
ImGui::SetCurrentDockContext(myDockContext);
// From now on you can use imguidock [calling BeginDockspace()/EndDockspace() and so on].
// When you destroy your application:
ImGui::DestroyDockContext(myDockContext);myDockContext=NULL;
*/
// (*) This is really mandatory only if you're not using an IMGUI_USE_XXX_BINDING, or if you don't know
// what IMGUI_USE_XXX_BINDING is (because otherwise the code above is already called for you in addons/imguibindings/imguibindings.cpp).
You're not using any imgui_addon binding, so you need that piece of code.
Closing this.
I want to use imguidock in visual studio.
I used the following code in the main loop:
but I got the following errors:
What can I do to recognize the addons file? Thanks