0

I work with visual studio 2015 community, on win7. Since my program reads a lot of files which are located in another folder, I generate the exe and copy the executable there.

The output window exits almost as soon as it shows up, so I cannot see what's going on. How can I solve this problem? I see some suggestions how to stop c++ console application from exiting immediately, but:

  1. getchar() and system("pause") do not help.
  2. I cannot run directly in visual studio, because input files are not available in the path of the executable.So, I don't think breakpoint works for me.

What's more, I have tried copying all the files to the same folder as the exe (myproject\Debug\myproject.exe), but after that, when I run, F5 or Ctrl+F5, it says debug assertion fails.

Community
  • 1
  • 1
userd
  • 3
  • 3
  • "_I cannot run directly in visual studio, because input files are not available in the path of the executable.So, I don't think breakpoint works for me._" : What stops you from copying the files to the path of the executable? – Jabberwocky Feb 18 '16 at 11:05
  • 4
    Did you try running your program from command prompt? – niyasc Feb 18 '16 at 11:05
  • 1
    could you show the source code ? – Van Tr Feb 18 '16 at 11:08
  • You can set the working directory for your debugged program to what ever you want: right click on your solution in the solution explorer, Select "Configuration Properties->Debugging", Change the working directory to whatever is needed. Then you can debug your program with the debugger. – Jabberwocky Feb 18 '16 at 11:08
  • 1
    When you get "debug assertion failed", click on "continue" and your program will break ito the debugger. Then you can see why the assertion failed etc. Learn to use your debugger. The debugger is your friend. – Jabberwocky Feb 18 '16 at 11:11
  • @IlDivinCodino I'm trying to understand [light-field descriptor](http://3d.csie.ntu.edu.tw/~dynamic/3DRetrieval/), source code is at the bottem of the page. I recompile the groundtruth part and run that. Then I encounter some probems. – userd Feb 18 '16 at 11:15
  • It's not illegal or immoral to use absolute paths and ignore the 'current working directory', in fact, the CWD is a PITA concept that causes more trouble than its worth. – Martin James Feb 18 '16 at 11:15
  • @niyasc Good point. I see what I want. – userd Feb 18 '16 at 11:25
  • @MichaelWalz I change the working directory. Now it acts just like what it does when I copy the exe. Thanks for that point and the debugging suggestion. – userd Feb 18 '16 at 11:28

0 Answers0