Configure launch command in Code::Blocks - codeblocks

I recently discovered Emscripten, and after downloading it, I decided to see if I could get it to work with Code::Blocks, so that I could easily test my applications to see how they performed when running as JavaScript.
I created a new compiler configuration, and set up all of the toolchain executables, except for the resource compiler (which doesn't seem to give me any problems), and the debugger. I wasn't really sure what to put in the debugger, because I remembered the debugger field as being a text-box. But when I looked, all that was there was a drop-down menu.
I managed to find a "Debugger" menu in the "Settings" menu, and when I opened it, there was a button called "Create config".
I created a new configuration, and pointed the executable path to "node.exe" (which runs .js files). I then went back to the compiler settings, and chose my new debugger in the drop-down.
I then tried to build and run a simple hello world application. But once it finished building, it gave me the message Execution of '[my file] ' in '[my project folder] 'failed. The actual build seemed to be successful, so I decided to manually run node.exe from the command line to see if I had configured the debugger incorrectly. And as I expected, it ran successfully.
While I was glad that I had successfully configured the compiler, I still was confused as to why the app didn't want to run. I also set Emscripten to create HTML files instead, to see if Code::Blocks would somehow recognize the appropriate program, and open it in the web browser instead. Of course that didn't work either.
What I am trying to figure out, is how I configure Code::Blocks' run command. Perhaps the debugger isn't even the right place to be looking. But I really need someone to help me figure out how I can configure this in Code::Blocks, as this is currently the only thing that is really giving me any trouble.
Thanks.

Possible but less ideal solution:
After some time, I was able to come up with a solution. However, I am sure that there are better alternatives.
To use this method:
Create a new build target called RunScript.
Set the compiler to No Compiler.
In the project properties, set the type to Console application.
Uncheck Auto-generate filename extension, and set the output filename to RunButton.bat.
Create a new file called RunButton.bat (or whatever you entered as the output filename).
Whatever you put in RunButton.bat will now be executed when you click the run button.
I also created a new virtual target that contained my RunScript target, and my main target, so that I don't have to switch targets whenever I want to test my application.
Problems with this method:
While this method does work, it is not ideal, as it requires you to have two extra targets (including the virtual target that I made for convenience). I would rather be able to just have everything contained in one target.
Slightly better solution:
A new solution that I decided to use, is to simply use the configure tools menu to create a tool that points to a batch file that runs my compiled programs.
To use this method:
Go to Tools>Configure Tools...>Add.
Fill in the name, and point the executable to the script that you want to run when this tool is used.
Fill in any needed parameters. You can use the built in ${TARGET_OUTPUT_FILE} macro to pass your output application as a parameter.
You can now use your tool by going to Tools>{My tool}, but you can set a hotkey by going to Settings>Editor...>Keyboard shortcuts.
Click the plus button by Tools, and click on your tool to set a shortcut for you tool.
Problems with this method:
While this method does eliminate the extra build targets, it doesn't let you run your script or run non-executable files by clicking the run button; which was the original intent. On top of this, you have to create a new tool anytime you want to add a new script.
I am hoping that someone else will be able to show me a better way of doing this, but for now this will work.

Might be a little late, but I was able to get the codeblocks run button to run any command by using a few post-build steps. The reason I need this is because my laptop has nvidia "optimus" and in order for my output program to see the discreet graphics card, I have to run it with the optirun prefix. So I added the following to the post-build steps in build options:
mv $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE)_bin
echo #!/bin/sh > $(TARGET_OUTPUT_FILE)
echo optirun $(TARGET_OUTPUT_FILE)_bin >> $(TARGET_OUTPUT_FILE)
chmod +x $(TARGET_OUTPUT_FILE)
It basically renames the output binary and creates a script replacing the original output binary name. When pressing the run button, the script is executed instead of the output.
On windows, you might have an issue running an exe extensioned file as a batch script so what if you generate the output file with a bat extension like in your first method, but with compilation and then rename it to exe in the post-build like this:
move $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).bat $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).exe
echo [WHATEVER YOU NEED TO RUN] > $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).bat

Related

The visual studio F# interactive window keeps not opening in current directory

So I want to work a little bit in the interactive window in visual studio, to take a look at some F#.
Now View>other windows>F# interactive
In order to load my file I then type
>#load "Distance.fs";;
It is important to mention that Distance.fs is the current file that I am standing on.
however now, I get this error:
It looks like it keeps looking in the wrong directory, and it keeps doing this across different files and projects. Why does this happen? Is there any way I can configure VS to always open the interactive windows on the currently open directory
FSI defaults its current directory to whatever %TEMP% is and just needs a little help. Create a scratch script (as #TheQuickBrownFox suggested), and put your #load statement in there. Above that, add
open System
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
Highlight those two lines and press Alt-Enter to tell FSI to change to the script's current directory, then your #load statement should work (if needed, adjust your path, for example if you create a separate scripts folder, then maybe you now need #load "../Distance.fs", etc.

Run a hidden cmd on click

This is driving me crazy. I have a pretty application that does.. well, things. To start it up, some start.cmd needs to be executed. What start.cmd does is to set up some environment variables, check a few things and then start my main GUI program.
Now, everything works fine: when I click on my start.cmd everything gets launched properly. However, clicking on start.cmd causes an ugly, ugly cmd.exe to appear for an instant and then disappear. This is unacceptable!
I started looking around and I found this. It suggests to use some wscript invisible.vbsto run my start.cmd. This, however, works fine from the terminal, but I can't click on invisible.vbs directly to get what I need.
This is where I thought that I could use shortcut with the wscript invisible.vbs start.cmd command in it. However, you cannot make relative path shortcuts in Windows, which means that if I use a shortcut I will never be able to move my folder again, which is pretty bad if I need to install it around my users' computers.
So I really have no clue on how to get this apparently trivial thing done: how can I get a start.cmd batch file executed without anything showing and without having to launch anything from the terminal, and in a way that will allow me to move my folder around?
Check the hidder.bat . You can use it to wrap a .bat or .exe file into iexpress executable file that will be ran in hidden mode.To use you need:
hidder.bat example.bat hiddenExample.exe
this line will create a hiddenExample.exe which clicked will start your bat in hidden/background mode.You can also take a look at this question

Is it possible to run terminal/command prompt inside Rubymine?

I would work much faster if I could have some kind of command line running inside rubymine, is this possible? When testing I repeatedly have to switch to my terminal window and it gets quite annoying.
I can run rails console and also the sandboxed version side rubymine aswell as my rails server and spork server.
It would be nice to have a command prompt inside rubymine also would speed things up. Infact that would make rubymine 100% perfect for my rails development as it does everything else require.
There is no such feature in IDEA platform based products. You need to run terminal externally. Note that you can create an External Tool to run terminal window in the current file or module directory for convenience.
UPDATE: Terminal (SSH console) was added in PhpStorm/WebStorm 7.0, IDEA 13, RubyMine 6, PyCharm 2.7.3.
I have used CrazyCoder's instructions to do this. Here are the instructions for Windows:
File, Settings
bottom half of menu is titled IDE Settings, look in this list to find External Tools
Click in the only available button (for most), [+]
give your custom thing a name ("terminal"? "command prompt"?)
most of this stuff you just leave blank
click the [...] button next to Program, then simply navigate to Windows/system32/cmd.exe
Lastly, unless you want to have your starting command line (terminal) path as C:\Windows\system32 (CHANGE YOUR PATH), simply click on the [...] next to the "Working Directory" just below, and change your path to Desktop or whatever it is you prefer.
Click OK.
You're done! It's that easy. Now to access this (no restart required), click on Tools, and then under 'XML actions' (for me anyway) you should find your "terminal" or "cmd" or whatever it is you called it. You can test it out with an 'ipconfig' command. You can always go back to the the settings/external-tools place you went to in the first place to edit your settings (like your default path), or to make another custom tool, because this (RubyMine External Tools creator) is obviously a very powerful tool.
If someone is searching this for rubymine in version 7.
Press Alt+f12 for the terminal.
Source : https://www.jetbrains.com/ruby/webhelp/working-with-embedded-local-terminal.html

How to change file icon in Turbo C++ and cc3270.dll

I started to use Borland's Turbo C++ a few days ago. I actually have two questions.
1.: How can i change the file icon?? If i create a program (Console Application), it will always have this blue icon (buildings or something like that on it), and i can't find it anywhere, how to change it to the default "none" icon (which like in Dev-C++ is the default).
2.: If i create a console application, and i want to run on my virtual pc, then it says that the CC3270.DLL is missing. If i copy it to c:\windows\system32\ then it will working perfectly. But i want to avoid this way. So is it possible, to change a setting or something like that, that my application won't need this file? It's disturbing beacuse, if i want to use my program on a computer which hasn't this dll, than i have to copy it there, on every machine.
Thanks in advance!
kampi
1.you can see these links
How do I change the program icon for a console application?
How to Create a Custom Program Icon for a Console Mode Application
2.If you build using the dynamic Run-Time Library, you will also have to distribute one or more of the Run-Time Library DLLs CC3270.DLL or CC3270MT.DLL and the memory manager DLL.
you must uncheck the option "build with runtime packages" located in the project options.
Bye.

How can I debug a single ruby script in netbeans?

All of this is on a windows xp box:
Netbeans managed to accept an existing rails project and allowed me to debug it just fine, but my project has a number of processing scripts that handle non-MVC aspects. The rails project is just a system for queuing requests for the execution of these scripts.
I've attempted to create netbeans projects using existing sources, but it fails for a number of reasons.
First, since I have a number of scripts in one place, netbeans complains that I can't add a source directory to the project because it already belongs to another project. If I put the script into its own, empty, directory and try to add that directory, netbeans stalls while trying to create the project and I have to end the process from the task manager.
If I create a new project for it, remove the default main.rb and replace it with the script I want to debug, the debug session will not start - netbeans complains that it cannnot find the program entry point.
It seems to me that if I can debug rails apps as easily as netbeans allows me to, that running a single standalone script would be trivial. What on earth am I missing?
UPDATE: Loading the script and doing "Debug/Debug File" isn't possible. The option is always greyed out, even for hello world.
Right click on the project, click Properties, choose Run, and change the Main Script to your script.
You can also debug a single file in Rails project by opening the file, then click Debug in menu toolbar, then Debug "file_name.rb". Or just press Ctrl-Shift-F5 on the opened file.

Resources