I am using Xcode to do c++ programming and I have a c++ code, with different input arguments. I want to achieve that in Xcode, I could run multiple simultaneous running of my c++ code. However, the current problem is that once one code finishes, its terminal window automatically closed and I do not have time to look at its result. Thus computer time is wasted.
Is there a way to run multiple same c++ code with different arguments input? Thank you.
One way I try out is to copy the whole folder, open the new project in the new folder, run, and afterwards delete the folders when you don't need the multiple run anymore....
Related
I'm using Rcpp to run C++ code using RGui (version 3.4.1) as a user interface. Quite often I make changes to the C++ code which compile correctly but cause errors (e.g. searching beyond the end of an array) when I run the relevant program in RGui, causing RGui to crash. This is aggravating because I have to re-open RGui, re-open my R script (sometimes with unsaved changes lost), set the working directory again, etc. before I can re-compile the C++ code and run the program in such a way as to find the problem or test amendments. Sometimes it promptly crashes again because I haven't fixed or bypassed the problem.
Is there some way to change the way Rcpp runs such that RGui returns an error message instead of crashing in these sorts of situations?
Briefly:
It is spelled Rcpp. Capital R, lowercase cpp.
Yes, don't have bugs :)
In general, 2. is the only viable answer. If you need a managed language, use R.
If the code takes your environment down, test outside the environment. Seriously. That is for example why I (co-)wrote littler and test "raw code" on the command-line: it can only take the command-line app down.
We do have a feature in eg RcppArmadillo to test for "out of bounds" vector access: use x.at(i,j) which will warn. See http://arma.sourceforge.net/docs.html#element_access
I don't actually know of a way to prevent this apart from more careful programming, and saving before execution. But having done this a few times I have discovered a way to get back at unsaved changes, (at least in windows).
When you get the pop-up that tells you to restart R, you don't do it. You open up task manager and right-click on the process and select 'Create Dump File'. Find this file in explorer and open it with some text editor.
They are very big, and full of all sorts of stuff, but if you use find function to search for some string you know to be in your script, then you can find all the unsaved work. You can then copy and paste this into another file to save.
If you use R-studio instead of R-GUI, it usually manages to look after your unsaved work better.
I use Geany in Ubuntu to write C++ code but using IDE standard terminal (pressing F5 to execute code and not opening a new terminal and typing ./a.out).
I can only run one program per time. Is it possible to run 2 or more programs at the same time in Geany?
It's not possible using default F5-execute command. If you want to start multiple instances of your application I recommend to use multiple terminals e.g. with multiterm or some wrapper. For 2nd opportunity you might want to check https://softwarerecs.stackexchange.com/
Is there a way to run the same c++ (with slight modification say in one of the file a=1 while in the other a=2) file simultaneous in Xcode? Currently, if I press command+R twice. I could add one more run, but then it seems Xcode does not support this quite well. Say, when one finishes, if the other is running and if I am viewing the result of the one that is not yet finished, then the finished one 's output would be gone.... Thank you:)
I wrote a small C++ program in VS2k8. When I launch it from windows (double click the exe file) it runs fine. When I go to the command prompt and try to run it it will hang and eventually crash. I've created test programs with simple outputs that work fine both ways.
Is there something I'm missing? I'm relatively new to programming. I'm trying to launch this program using the VBA shell command but it produces the same outcome as the command prompt.
The funny thing is it was working fine at first until I went in to change the value of a constant variable and rebuilt it (I didn't think that had anything to do with it but I changed it back with no success). No settings where changed.
Edit: I've name it time.exe and than copies.exe (when I tried copying and pasting the code into a new project). The actual code is about 250 lines, not sure what part of it would be causing the issue. It opens a .csv file, loads the information into vectors, and then compares the vectors to each other (adding something to the end of it if it meets certain conditions). It than outputs the file to another .csv file.
Might suggest that the current directory on start up is different and this is causing your issue as you make some assumptions about the current path or drive?
I'm creating a Win32 program that will be executed every time the computer turns on. I manage to do this by adding the .exe path into the registry. The problem is; I want to make the program appear minimized in the system tray when the computer is turned on but if I double click it [after the computer turns on and the program is not currently running] the program should appear on its normal [maximized] size.
Question, I was thinking on whether is was possible to pass an argument to the program when the program is executed from the registry. Is this possible? If yes/no, how would I manage to do this?
(Using windows XP) Thanks.
Yes, if your using HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run you can simply quote the path & add a command line:
Your App = "c:\xxxx\yourapp.exe" /mycommand
Even if it's not possible to launch your program with command line arguments from the registry, you can use a batch script to do so. Just create a batch script that launches your program with the appropriate arguments, and use the registry to run that batch script instead.
Why not put arguments on the program's shortcut instead? That way you can make the default behavor be what it does on system startup, and use the arguments on the shortcut to tell it how to behave when the user starts it.