Моя программа не запускается/не создается exe-файл.
Я использую SDL3 -3.1.6 и ImGui-1.91.7
GameLauncher.cpp
Код: Выделить всё
#include "GameLauncher.h"
int main(int argc, char* argv[]) {
init_Window("Drone Override", 1920, 1080);
return 0;
}
Код: Выделить всё
#pragma once
#include
#include "gWindow.h"
using namespace std;
Код: Выделить всё
#include "gWindow.h"
void init_Window(const char* title, int width, int height) {
SDL_Init(SDL_INIT_VIDEO);
// Create a window with OpenGL context
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_Window* window = SDL_CreateWindow("Drone Override", width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY);
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
SDL_GL_MakeCurrent(window, gl_context);
SDL_GL_SetSwapInterval(1); // Enable vsync
// Initialize Dear ImGui
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
ImGui::StyleColorsDark();
// Setup Platform/Renderer bindings
ImGui_ImplSDL3_InitForOpenGL(window, gl_context);
ImGui_ImplOpenGL3_Init("#version 330");
bool running = true;
SDL_Event event;
while (running) {
// Poll and handle events
while (SDL_PollEvent(&event)) {
if (event.type == SDL_EVENT_QUIT)
running = false;
ImGui_ImplSDL3_ProcessEvent(&event);
}
// Start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL3_NewFrame();
ImGui::NewFrame();
// Create ImGui UI
ImGui::Begin("Hello, Dear ImGui!");
ImGui::Text("This is a simple example.");
if (ImGui::Button("Exit"))
running = false;
ImGui::End();
// Rendering
ImGui::Render();
SDL_GL_MakeCurrent(window, gl_context);
glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
SDL_GL_SwapWindow(window);
}
// Cleanup
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplSDL3_Shutdown();
ImGui::DestroyContext();
SDL_GL_DestroyContext(gl_context);
SDL_DestroyWindow(window);
SDL_Quit();
}
Код: Выделить всё
#pragma once
#include
using namespace std;
// SDL3
#include "SDL3/SDL.h"
#include "SDL3/SDL_video.h"
#include "SDL3/SDL_opengl.h"
// ImGUI
#include "imgui.h"
#include "imgui_impl_sdl3.h"
#include "imgui_impl_opengl3.h"
void init_Window(const char* title, int width, int height);
path\imgui-1.91.7 \backends
path\imgui-1.91.7
path\SDL3-3.1.6\include
Компоновщик >>> Общие >>> Дополнительная библиотека Каталоги:
path\SDL3-3.1.6\lib\x64
Linker >>> Ввод >>> Дополнительные зависимости:
SDL3.lib
opengl32.lib
Ошибка : LNK2019
неразрешенный внешний символ "struct ImGuiContext * __cdecl ImGui::CreateContext(struct ImFontAtlas *)" (?CreateContext@ImGui@@YAPEAUImGuiContext@@PEAUImFontAtlas@@@Z), на который ссылается функция "void __cdecl init_Window(char const *,int,int)" (?init_Window@@YAXPEBDHH@Z)
Подробнее здесь: https://stackoverflow.com/questions/793 ... tudio-2022