Debugging guide

116 views
Skip to first unread message

Chris Nottingham

unread,
Apr 26, 2018, 11:36:25 PM4/26/18
to TMB Users
Hi I have always struggled with debugging a TMB program. My greatest issue is that the compile function returns ridiculous amounts of text and very little of it is meaningful. It would be extremely helpful if there was a guide for how to best set up the compile function such that only relevant text be returned (e.g., can you specify that just the first n errors be returned).

Currently, I have just been using the flag "-w" so warnings are not returned. However, the amount of text returned is still too much.

Any tips would be appreciated.

Hans Skaug

unread,
Apr 27, 2018, 12:49:11 AM4/27/18
to TMB Users
If you use Rstudio, that will take you directly to the line with the first compilation error.
See details (search for Rstudio):




Chris Nottingham

unread,
Apr 27, 2018, 1:03:55 AM4/27/18
to TMB Users
Thanks Hans, this is very helpful.

Chris

Mark Maunder

unread,
Aug 19, 2020, 6:53:43 PM8/19/20
to TMB Users
I have started using TMB:::setupRStudio() and it is great to have something that takes you right to the line in the code where the error is. However, the compiler often hangs on some cpp files. for example simply adding any of the following cout statements causes issues. 

#include <iostream>
using std::cout;
using std::endl;
std::cout<<X[year+1]<<std::endl;
cout<<X[year+1]<<endl;

I have had several other model code that appears to cause the compiler to hang. Once it compiled with an error, then fixing the error made it hang.
 
Does anyone have any idea of what the issue is and how to fix it.

Hans Skaug

unread,
Aug 20, 2020, 3:24:15 AM8/20/20
to TMB Users
Hi,

I am using  TMB:::setupRStudio() , and I must admit that the compiler sometimes hang for me as well.
However, I had not made the connection to TMB:::setupRStudio() , so that is useful to know.

I tried to include the code you quoted, and it does not cause problems for me (in fact I have
not seen any pattern in what is causing the compiler to hang).

I am inclined to wait and see if the problem goes away in future versions of Rstudio.

mark...@gmail.com

unread,
Aug 25, 2020, 5:09:02 PM8/25/20
to TMB Users
I tried a few things including reinstalling R and Rstudio (interestingly  setupRStudio  stays there). What fixed it was updating TMB, which is wht I should have tried first.. 
Reply all
Reply to author
Forward
0 new messages