C ++程序没有到达主

时间:2018-02-01 03:17:33

标签: c++ visual-studio main

这是main.h,我与你分享以防这里出现问题。但我不这么认为。

然后,main.cpp这是我程序的切入点 如果我使用 Visual Studio 2017 生成它,它将编译并运行没有错误,但它不会在控制台上打印任何内容。

我无法弄清楚原因。

main.h:

#pragma once

#include <thread>

#include "GabEngine/MainEngine.h"
#include "GraphicInterface/Console.h"
#include "GabEngine/Globals.h"

int m_ScreenWidth = 500, m_ScreenHeight = 500;
GabEngine::Wind m_RootWindow;
GabEngine::MainEngine m_MainEngine(&m_RootWindow);
Globals::NetworkStatus NetStatus;
Networking::MainNetwork m_MainNetwork(&NetStatus);

void TaskConsole();
void TaskNetwork();

main.cpp中:

#include "GraphicInterface/main.h"
#include <iostream>

#undef main

void TaskConsole()
{
    if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
    {
        GabEngine::FatalError("Failed to initialize SDL");
    }

    m_RootWindow.Create("Utryon", m_ScreenWidth, m_ScreenHeight, 2);
    m_MainEngine.InitShaders();
    m_MainEngine.InitCEGUI("C:/Users/Bob/Documents/Visual Studio 2017/Projects/Utryon/GabEngine/GUI");
    m_MainEngine.LoadScheme("UtryonLook.scheme");
    m_MainEngine.SetFont("DejaVuSans-10");

    GraphicInterface::Console MainConsole(&m_MainEngine, &m_MainNetwork);
    MainConsole.InitConsole();
    MainConsole.Run();
}

void TaskNetwork()
{
    m_MainNetwork.Run();
}

int main(int argc, char** argv)
{
    std::cout << "Here 1" << std::endl;  //It is supposed to print Here 1
    thread ConsoleThread(TaskConsole);
    thread NetworkThread(TaskNetwork);

    ConsoleThread.join();
    NetworkThread.join();

    // End of program
    return 0;
}

0 个答案:

没有答案