Sublime Forum

C++ Build&Run

#1

Hi Support
I’m fairly new to Sublime Text however I have to say it’s great
however I’m currently using it to do some C++ work and I noticed that if I have an input (cin) the build and run skips the input and keeps running the program,
This is a little bit of a problem. is there a setting I can change to open a separate konsole window and run the binary there so I can interact with the program as designed?. I have been looking at the build-systems and I’m wondering am I on the right path or if someone has already done this can they please point me in the right direction.
Cheers
Mark

0 Likes

#2

Ok so before someone tell’s me off for this I know custom packages are ment to go in your home folder config
However I was editing the C++ package in the install folder I edited “C++.sublime-build” and tried both of the following and reloaded ST3 however with no results

	"variants":
	
		{
			"name": "Run",
			"shell": true,
			"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
		}

	]

This just ran the code as normal not in a shell prompt :frowning:

	"variants":
	
		{
			"name": "ShellRun",
			"shell": true,
			"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
		},
		{
			"name": "Run",
			"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
		}

	]

While this just only listed the Run Variant it never mentioned the Shell Run please bear in mind I am new to ST3. I repacked the file and it just continued as normal. I know it’s reading the file as I made a typo and it kicked up about that.
Can anyone please shed some light on this please.
Question if I have a package of the same name in ~/.config/sublime-text-3/Packages/User will it over-ride or take precedence over the package in the install folder?
Thanks I will post any further progress but any help is welcome

Thanks
Mark

0 Likes

#3

Ok sorry for being the Noobie when I looked in the command palette the shell run was there as defined by

		{
			"name": "ShellRun",
			"shell": true,
			"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
		}

However it still doesn’t run in an interactive shell :frowning: any thoughts people please

0 Likes

#4

I’ve hit a brick wall guys any help please feel free to post

0 Likes