Click here to Skip to main content
15,886,873 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionVS 2010 C++ Debug Pin
Harry_D11-Nov-15 5:02
Harry_D11-Nov-15 5:02 
AnswerRe: VS 2010 C++ Debug Pin
Richard Andrew x6411-Nov-15 6:27
professionalRichard Andrew x6411-Nov-15 6:27 
Questionmemory allocation error Pin
Member 1208345310-Nov-15 20:34
Member 1208345310-Nov-15 20:34 
AnswerRe: memory allocation error Pin
CPallini10-Nov-15 21:54
mveCPallini10-Nov-15 21:54 
GeneralRe: memory allocation error Pin
Member 1208345311-Nov-15 0:28
Member 1208345311-Nov-15 0:28 
GeneralRe: memory allocation error Pin
CPallini11-Nov-15 0:30
mveCPallini11-Nov-15 0:30 
QuestionRe: memory allocation error Pin
David Crow11-Nov-15 2:43
David Crow11-Nov-15 2:43 
GeneralRe: memory allocation error Pin
Stefan_Lang13-Nov-15 4:23
Stefan_Lang13-Nov-15 4:23 
1. Always post the code that you actually use and that shows the described (problematic) behaviour
2. Cleaning up your code can occasionally help, but if you do so, then (a) make sure the clean code still compiles (and runs) to the extent the original code did, and (b) make sure the code still shows the same issue(s)! There really is no point discussing code that doesn't show the behaviour you are describing.
3. Learn to use a debugger, step through your code, and examine the current value of your local variables. Since you already know where you're crashing, it's a good starting point to set a break point before the call to push_back(), and investigate the state of your variables then.

Bonus tip: remove that line using namespace std; It is a crutch and will make it more difficult to spot issues in your code. You'll need to add the prefix std:: in many places, so that requires additional typing, but it really isn't that hard, and it adds to the readability of your code as well as reducing the likelyhood that you're mixing up local and library symbols! The extra effort of always typing std:: pays off very quickly!

If you don't believe me, the warnings are all over the place right in the C++ reference. See for example http://en.cppreference.com/w/cpp/language/namespace#Using-directives[^]:

cppreference.com wrote:
Using-directive does not add any names to the declarative region in which it appears (unlike the using-declaration), and thus does not prevent identical names from being declared.

and

cppreference.com wrote:
The using-directive using namespace std; at any namespace scope introduces every name from the namespace std into the global namespace (since the global namespace is the nearest namespace that contains both std and any user-declared namespace), which may lead to undesirable name collisions. This, and other using directives are generally considered bad practice at file scope of a header file.

Emphasis mine.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

QuestionStandalone Windows Application using Visual C++ and SQL DB is possible? Pin
Member 1212982010-Nov-15 11:36
Member 1212982010-Nov-15 11:36 
AnswerRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
Garth J Lancaster10-Nov-15 12:14
professionalGarth J Lancaster10-Nov-15 12:14 
PraiseRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
David Crow10-Nov-15 14:40
David Crow10-Nov-15 14:40 
QuestionRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
David Crow10-Nov-15 14:41
David Crow10-Nov-15 14:41 
AnswerRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
Richard MacCutchan10-Nov-15 23:02
mveRichard MacCutchan10-Nov-15 23:02 
GeneralRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
Member 1212982016-Nov-15 11:02
Member 1212982016-Nov-15 11:02 
Questionconverting sound to text software from c++ Pin
Member 121226567-Nov-15 16:47
Member 121226567-Nov-15 16:47 
AnswerRe: converting sound to text software from c++ Pin
Richard MacCutchan7-Nov-15 21:13
mveRichard MacCutchan7-Nov-15 21:13 
QuestionKinect V2 (Converting code written for Xtion pro live to kinect v2 compatible form) Pin
ArsalanSaeed7-Nov-15 12:45
ArsalanSaeed7-Nov-15 12:45 
QuestionKinect V2 (Angle detection between 2 joints) Pin
ArsalanSaeed7-Nov-15 12:39
ArsalanSaeed7-Nov-15 12:39 
QuestionMFC CListCtrl how to Display SubItem text with tabulator ? Pin
Member 85340357-Nov-15 3:43
Member 85340357-Nov-15 3:43 
AnswerRe: MFC CListCtrl how to Display SubItem text with tabulator ? Pin
Richard MacCutchan7-Nov-15 5:04
mveRichard MacCutchan7-Nov-15 5:04 
GeneralRe: MFC CListCtrl how to Display SubItem text with tabulator ? Pin
Member 85340357-Nov-15 5:08
Member 85340357-Nov-15 5:08 
GeneralRe: MFC CListCtrl how to Display SubItem text with tabulator ? Pin
Richard MacCutchan7-Nov-15 5:51
mveRichard MacCutchan7-Nov-15 5:51 
GeneralRe: MFC CListCtrl how to Display SubItem text with tabulator ? Pin
Member 85340357-Nov-15 6:30
Member 85340357-Nov-15 6:30 
GeneralRe: MFC CListCtrl how to Display SubItem text with tabulator ? Pin
Richard MacCutchan7-Nov-15 7:16
mveRichard MacCutchan7-Nov-15 7:16 
QuestionRe: MFC CListCtrl how to Display SubItem text with tabulator ? Pin
David Crow8-Nov-15 9:24
David Crow8-Nov-15 9:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.