"One or more breakpoints cannot be set and disabled. Execution will stop at the beginning of the program."

I set a breakpoint in my code in Visual C ++, but when I run, I see the error mentioned in the header.

I know this question was asked earlier in Qaru ( Breakpoints cannot be set and disabled ), but none of the answers there fully explained the problem I see. The closest I see is something about the linker, but I donโ€™t understand this - so if someone could explain in more detail what would be great.

In my case, I have 2 projects in Visual C ++ - production dsw and test code dsw. I downloaded and rebuilt both dsws in debug mode. I want a breakpoint in production code that runs through test scripts. My problem: I get an error when running the test code because the breakpoint is in the production code, which does not load when the test starts.

At the beginning of the test script, there is the mytest_initialize () command. I guess this goes away and loads the production dll. Once this line is executed, I can put the breakpoint in my production code and run until I hit it. But it is rather annoying when you need to run to this line, set a breakpoint and continue every time I want to run a test.

So, I think that the problem in Visual C ++ does not mean that the two projects are related. Is this a linker problem? What does the linker do and what settings should be changed to make this work?

Thanks in advance. Sorry if instead I have to add this question to an existing one, this is my first post, so I'm not quite sure how this should work.

[Update 1] I think Chris O identified the problem. I will add another update if I can decide how to use the project options to make this work.

+4
source share
4 answers

It looks like you are using VC6 since you are mentioning dsw files. I think this is just as good as in VC6, you need to manually add a breakpoint after loading the module from LoadLibrary. In fact, there may be a project debug setting, so you can specify which DLLs to load when debugging your project, which will support your breakpoints when you press F5.

You can also try connecting a debugger after you know that mytest_initialize () has been called, which can support your breakpoints.

+1
source

I had this problem sometimes, but always pass it along with some steps to replace the code.

There is some guy here, how he fixed it.

Hope this helps.

0
source

In my case, I solved this by setting the DLL project containing the breakpoint as the active project and changing the debugging options for this project (right-click the project โ†’ settings โ†’ debug tab) to point to the project that actually starts and the DLL accesses . โ€œExecutable for debugging session:โ€ and โ€œWorking directory:โ€ must be installed on the executable file that you really want to run, and the corresponding directory.

Hope this helps.

0
source

right click on the project -> settings -> Link tab check on Create debug information check the link step by step

0
source

Source: https://habr.com/ru/post/1309099/


All Articles