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 - HelbMePlease

Pages: [1]
General / Re: Problem with debugging in VSCode+gdb
« on: August 16, 2023, 05:32:37 pm »
A quick web search lead me to some similar posts, maybe you can find some answers there:

Oh thanks, but I already solved this problem with the nice folks over at the discord server. I just needed to use the CMake boilerplate you guys put up on GitHub and download some linux dependencies so the debugger knew how to interpret the data. Should I mark this thread with [SOLVED] marker or do we not do that in these forums?

General / Re: Problem with debugging in VSCode+gdb
« on: August 01, 2023, 10:11:51 pm »
Update: it's definitely an SFML-related problem as I tried a very similar scenario with a vector of primitive types and a little class I whipped up for testing and it all worked fine. Only when I tried to use a vector of sf::RectangleShape did the problem reappear.

General / Problem with debugging in VSCode+gdb
« on: July 31, 2023, 09:35:56 pm »
Hey everyone,
I used the CMake Tools VSCode extension to set up a debugging environment (I hardly did anything) using the gcc kit. It was all going fine until I tried to inspect the contents of a vector and it shows empty even though I know (almost for certain) it isn't. Here's the relevant code:
void squares(std::vector<sf::RectangleShape> &squares_vec)
    for (size_t i = 0; i < 81; i++)
        sf::Color grey(140,140,140);
        sf::Color gainsboro_grey(207,208,207);
        sf::RectangleShape square(sf::Vector2f(70,70));
    std::cout<<"Number of squares in vec: "<<squares_vec.size()<<std::endl;
The std::cout prints 81 squares in vec (as intended) so everything in that function seems okay  but I need the debugger to be working well to debug the subsequent function ( place_squares() ) which is not working okay. What I mean by the debugger is telling me the vector is empty is that is what it shows in the VSCode debugging GUI on the left panel of VSCode, which I am using. Below are some more documents you may find useful.



#This CMakeLists.txt is a frankenstein mixture between what CMake Tools auto generates and some changes I made based on
#this Example CMake script (so it would link the libraries): https://en.sfml-dev.org/forums/index.php?topic=24070.0

cmake_minimum_required(VERSION 3.0.0)
project(sfml-app VERSION 0.1.0 LANGUAGES C CXX)


find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)
add_executable(sfml-app main.cpp)
target_link_libraries(sfml-app sfml-graphics sfml-audio)

set(SFML_DIR "<sfml root prefix>/lib/cmake/SFML")

cmake_minimum_required(VERSION 3.1)


## If you want to link SFML statically

## In most cases better set in the CMake cache


  "directory": "/home/dudefellaman/Desktop/SFML Code/Sudoku/build",
  "command": "/usr/bin/g++   -g -o CMakeFiles/sfml-app.dir/main.cpp.o -c \"/home/dudefellaman/Desktop/SFML Code/Sudoku/main.cpp\"",
  "file": "/home/dudefellaman/Desktop/SFML Code/Sudoku/main.cpp"

If you need anymore info, ask away!

Pages: [1]