Hello ladies and gents,

I wanted to ask if any of you could tell me what I'm doing wrong when I want to debug any program that Ive written in VC++ 2005 Express Edition.

Reason is, after I put a break point to where the program has to run and then debug and push the debug button, I get a message going like this:

Debugging information for 'AccCppEx.exe' cannot be found or does not match. Binary was not build with debug information.

Do you want to continue debugging?

After that, the break point becomes a circle with an exclamation '!' and says that:

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

Can someone help me out here, because I'd like to see what my program is doing so I can make alterations to it.

Thanks for any help.

Right Click your project from the project explorer.
Go to Configuration Properties->Linker->Debugging
Most probably the Value in the "Generate Debug Info" should be "No".
Set it to "Yes (/Debug)" and try debugging again.

Thanks for the help WolfPack, that solved the first problem, but not the second problem wich is the breakpoint.

It still says: "The breakpoint will not currently be hit. No symbols have been loaded for this document." and when I enter the required info into the program so that it can get towards the breakpoint, the program just runs as it should and then exits succesfully, without giving me the opportunity to actually debug it and see every step beginning from the breakpoint.

Maybe the line where you set the breakpoint is not executed. Could you give us the part of the program where you set the breakpoint? The line where the breakpoint is set and 2 or 3 lines above and below it will do.

Sure, here it is:

vector<Student_info> students;
	Student_info record;
	string::size_type maxlen = 0;					//the length of the longest name

	//read and store all the students data
	//Invariant:	studentscontains all the student records read so far
	//				maxlen contains the length of the longest name in students
	while (read(cin, record))
	{
		//find length of longest name
		maxlen = max(maxlen, record.name.size());
		students.push_back(record);
	}

Ive putted the breakpoint on the

while (read(cin, record))

line.

is record.name a std::string object? If it is, I might be wrong but I don't think you can do binary reads and writes like you are doing with that string because all that is getting read/written is the number of bytes in the class itself -- the string is not part of the class. If std::string == "Hello World", then write() will only write sizeof(std::string), not the text. For binary files, you will have to write/read a fixed-length structure that contains C character arrays.

class record
{
  . ..
  char name[80];
 ...
}

There are other more complex ways to do it that will allow you to use std::string in the class record, but the above is the simplest.

Although setting the breakpoint at the current position looks okay, for now set the breakpoint at

maxlen = max(maxlen, record.name.size());

and see if the program stops at that point. If you already didnt know you have to press F10 to execute the code line by line. If it doesnt stop even then, there is someother problem, but I cant seem to get the cause.

And make sure "Solution Configurations" is set for Debug, not Release

is record.name a std::string object?

Hi AD,

It's a struct which looks like this:

struct Student_info
{
	std::string name;
	double midterm, final;
	std::vector<double> homework;
};

The thing I want to do is, input values that are needed per Student like this:
Johan 80 80
75
79
80
and when this is written, go further into the program to see what the program is doing and how.
Ive tried to put breakpoints in other sections of the program but keep getting the same result as in the breakpoint changing from a full point to being just a circle with an exclamation '!' and saying the above sentence "The breakpoint will not currently be hit. No symbols have been loaded for this document."

Although setting the breakpoint at the current position looks okay, for now set the breakpoint at

maxlen = max(maxlen, record.name.size());

and see if the program stops at that point.

Did that, same result.

If you already didnt know you have to press F10 to execute the code line by line. If it doesnt stop even then, there is someother problem, but I cant seem to get the cause.

When I hit F10, I get Assembler code, not the code I can follow to see how and what the code is doing.

Could it be that I can change the Assembler code into C++ code so that I can follow it?

Another thing, can you tell me what is in the field "Generate Program Database File" that is located right below the "Generate Debug Info" field?

And make sure "Solution Configurations" is set for Debug, not Release

Where can I see that this is correct AD?

Another thing, can you tell me what is in the field "Generate Program Database File" that is located right below the "Generate Debug Info" field?

This is written there WolfPack:
$(TargetDir)$(TargetName).pdb

Oh, now I understand -- reading from keyboard not a data file. It makes sense now. But should use getline(), not read. And use record.name.

while (getline(cin, record.name))

Oh, now I understand -- reading from keyboard not a data file. It makes sense now. But should use getline(), not read. And use record.name.

while (getline(cin, record.name))

Wait, so you're saying that I have to change the program just so that I could debug it ?

read(cin, record) is a function, so in main, I'm calling this function, by changing this, won't I deny passage to that function then?

$(TargetDir)$(TargetName).pdb

Okay that is what is expected. Try Dragon's suggestion.

Where can I see that this is correct AD?

On my setup (default as installed), there is a combo box located immediately below the menu bar that lets you select either Debug or Release. Not sure how to get to it via the menus. If you have Release mode set then you will get the problems you are experiencing.

Well, euhm, it's working, but, how, .... don't know, I exited the program, reopened it, opened the project and I could use Step Into, Step Over, Show Next Statement, ...

The only thing that I can't see yet is, when I use for instance Step Into, in VC++ 6.0 I could see the variable being implemented into the program, how can I arrange this in VC++ 2005????

Anyway, thanks very much guys, I made the changes you instructed and apparantly, I can now atleast use the debugger :!:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.