Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - jace10

Pages: [1]
5 years later and this helped me, thanks for posting how you ended up fixing!

I was able to get past this,

None of the MSDN articles I could find mentioned how to include things other than other libraries, but then I tried the "dumb" solution of just dragging everything I needed into the "File System on Target Machine" view in my setup project. Attached screenshot.

After doing that, running the installed exe works fine!

I was able to create and print to a console using:

freopen("CONOUT$", "w", stdout);
std::cout << "This works" << std::endl;
std::cout << "App Started" << std::endl;

This has helped me figure out that the issue is that my code is looking for an asset file which it can't find in the install location, and looking there I can see that the asset files are not there. I need to figure out how to get the installer to put asset files in the installation directory.

If anyone has experience/guides for that, it would be very welcomed :D

Sorry let me clarify:

Debug mode build&run from VS: works
Release mode build&run from VS: works

Setup Installer Debug mode, launch with VS open: instant crash
Setup Installer Release mode, launch with VS open: instant crash
Setup Installer Debug mode, launch with VS closed: instant crash
Setup Installer Release mode, launch with VS closed: instant crash

Does anyone know of any good guides besides https://learn.microsoft.com/en-us/cpp/ide/walkthrough-deploying-your-program-cpp?view=msvc-170 to walkthrough deploying a c++ program? I can't seem to find anything besides that one that walks through everything one would need to know. Or know of any books? I can't really figure out how I'm going to figure out what I don't know.

I have a feeling my error is due to the asset files not being installed anywhere, but its very hard to figure out what's going on, as it still crashes even if i specify my asset files as content and have the installer include content files.

Is there a way to get the program to dump errors to console?

By "same behavior" I meant that it crashes immediately with or without VS open.

Thank you for these notes, I will take a look at this. I don't think I have any absolute paths but it would be worth a check. I had thought that the Installer project I made in VS would include that Visual C++ redist, but maybe I'm missing a step there.

Im not planning on distributing debug builds, I was just trying that since the release build .exe closes right after opening.

I just tested it and it seems to have the same behavior with or without Visual Studio open.

Can you elaborate how I would find out what run time libraries I am using? My installer seems to find all the dependencies and include them, I've attached what it looks like in the folder after the installer is done.

Should I be concerned I don't see SFML in there? I am using the static SFML libraries so I don't need extra dlls correct?

General / Help with game crashing on startup when run with an installer
« on: August 30, 2023, 07:25:52 am »
I am wondering if anyone here is familiar with issues when trying to make your game playable by others/distribute it.

I have my Debug and Release configurations both targeting x64, and made sure I am using 32 bit libraries for everything. The game works when I run it from visual studio in both Debug and Release configurations. I created a Setup Installer project, following https://learn.microsoft.com/en-us/cpp/ide/walkthrough-deploying-your-program-cpp?view=msvc-170. This Setup also builds without any errors or warnings.

However both on my PC and on any other I've tested on, when I install the program using the .msi generated by the Setup Installer project (which also installs successfully), when I go to run the game the window comes up white for a second and then goes away on its own in release mode. In Debug mode it throws up a popup saying "Debug Error".

I assume something must be happening with the dependencies, but I don't see any log output or any kind of feedback on why the app crashed.

Does anyone have experience on how to debug something like this or what might be the issue?


Graphics / Re: Issue with Font when multiple threads are introduced
« on: May 15, 2020, 09:13:23 pm »
From what I can tell, the sf::Font class itself looks identical whether im running with the thread in the beginning or not, what else could I be looking at in the SFML area to ensure I initialized it correctly?

Graphics / Re: Issue with Font when multiple threads are introduced
« on: May 12, 2020, 12:55:33 am »
Here is where the thread is created and joined:

void loadEvents()

int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
  //init logger
  loguru::add_file("everything.log", loguru::Append, loguru::Verbosity_MAX);

  //init RNG
  srand(static_cast<unsigned int>(time(NULL)));

  thread eventLoadingThread(loadEvents);

  //instantiate scene classes
  MainMenu mainMenu = MainMenu();
  BattleScene battleScene = BattleScene();
  MapScene mapScene = MapScene();
  SceneManager sceneManager = SceneManager(&mainMenu, &battleScene, &mapScene);

  //main window loop
  return 0;

this is in my Main.cpp. EventHandler::getInstance triggers EventHandler to initialize its large array of objects, some of which include SFML entities, but no Font calls are made.

Graphics / Issue with Font when multiple threads are introduced
« on: May 11, 2020, 12:42:27 am »

I am writing a program, everything was going very smoothly with SMFL until I started trying to add some threads. I ran into an issue that causes a slight 5 second delay, (initializing/filling large array), so I wanted to spin off a thread at startup to get it out of the way early. However once I introduce the thread, my program always gets a "Read Access Violation" when it tries to call getGlobalBounds on one of my sf::Text objects later on, full call stack looks like this:

    redBeard.exe!sf::Texture::update(const sf::Texture & texture, unsigned int x, unsigned int y) Line 478   C++
    redBeard.exe!sf::Texture::update(const sf::Texture & texture) Line 443   C++
    redBeard.exe!sf::Font::findGlyphRect(sf::Font::Page & page, unsigned int width, unsigned int height) Line 732   C++
    redBeard.exe!sf::Font::loadGlyph(unsigned int codePoint, unsigned int characterSize, bool bold, float outlineThickness) Line 613   C++
    redBeard.exe!sf::Font::getGlyph(unsigned int codePoint, unsigned int characterSize, bool bold, float outlineThickness) Line 363   C++
    redBeard.exe!sf::Text::ensureGeometryUpdate() Line 519   C++
    redBeard.exe!sf::Text::getLocalBounds() Line 362   C++
    redBeard.exe!sf::Text::getGlobalBounds() Line 369   C++
>   redBeard.exe!Button::displayText() Line 53   C++
    redBeard.exe!Button::addDrawables() Line 150   C++
    redBeard.exe!MainMenu::setup() Line 84   C++
    redBeard.exe!SceneManager::init() Line 83   C++
    redBeard.exe!SceneManager::SceneManager(MainMenu * mainMenu, BattleScene * battleScene, MapScene * mapScene) Line 12   C++
    redBeard.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 49   C++

To be clear, right now I am joining on the thread, I see the same behavior whether I join it or detach it. The crash is occuring from my main thread, after the loading thread has completed (I know this because of the join).

I thought that perhaps if the other thread was calling loadFromFile on a font, it might be messing it up, but I have verified through debugging that my helper thread is calling no Font functions.

Here is what the full function that is crashing looks like:

void Button::displayText()
  std::lock_guard<std::mutex> lck{ buttonSfMutex };
  if (StringDb::StringEnum::NUM_STRINGS != textIndex)
    std::string textContents = StringDb::getString(textIndex);
    *textLabel = sf::Text();
    font = sf::Font();
    if (true == active)
    sf::FloatRect textBounds = textLabel->getGlobalBounds();
    if (textBounds.width <= width && textBounds.height <= height)
      //center text within button
      textLabel->setPosition(x + ((width - textBounds.width) / 2), y + ((height - textBounds.height) / 4));
    } //else, dont bother being smart about where its goin
      textLabel->setPosition(x, y);

The font variable is declared like so in Button.h:

  sf::Font font;

If I comment out the thread from running, everything works fine, so I think it has to have something with that, but I don't understand what could be going wrong since the font is local to the button and is being loaded in this function.

I appreciate any ideas, please let me know if you need to see more code or explanation on how I am doing something upstream.

Pages: [1]