How to configure the entry main file in VS2022

Xiao Yi 0 Reputation points
2024-12-07T09:40:51.64+00:00

Problem: F11 cannot enter the main.cpp of the project, but exe_main.cpp under VS2022.

Process: One time during debugging, for some unknown reason, I couldn't hit the breakpoint in Debug mode. When pressing F11, it prompted me to choose one exe_main.cpp. I wasn't sure whether to choose the main.cpp of the project or the exe_main.cpp under VS2022. Judging from the name, the latter seemed more in line with the conditions, so I chose exe_main.cpp

User's image

When I press F11, it will enter the exe_main.cpp mentioned just now

User's image

Then when I press F5, the software starts, but it cannot enter the breakpoint of my program, and the color and style of the breakpoint are also abnormal. The following is the breakpoint in MainWindow.cpp

User's image

The prompt content is: The breakpoint will not be hit currently. No symbols have been loaded for this document.

My project is generated through CMakeLists. After creating the project, I haven't modified the pdb-related configuration, and previously these configurations worked by default.

I restarted the computer, deleted the configuration folder of VS2022: %appdata%\Microsoft\VisualStudio\17.0_4979ebb8.

Then I deleted the build folder in the project and recreated it.

mkdir build
cd build
conan install ..
conan build .. -c

Then I opened VS2022, pressed F11 to enter the debugging mode, but the situation was the same as before.

Developer technologies | C++
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.