Home Download Buy Blog Forum Support

C++ Build&Run

C++ Build&Run

Postby markmcn on Sun Dec 08, 2013 12:53 pm

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
markmcn
 
Posts: 5
Joined: Sun Dec 08, 2013 12:48 pm

Re: C++ Build&Run

Postby markmcn on Sun Dec 08, 2013 10:30 pm

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
Code: Select all
   "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 :(

Code: Select all
   "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
markmcn
 
Posts: 5
Joined: Sun Dec 08, 2013 12:48 pm

Re: C++ Build&Run

Postby markmcn on Mon Dec 09, 2013 12:35 am

Ok sorry for being the Noobie when I looked in the command palette the shell run was there as defined by
Code: Select all
      {
         "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 :( any thoughts people please
markmcn
 
Posts: 5
Joined: Sun Dec 08, 2013 12:48 pm

Re: C++ Build&Run

Postby markmcn on Mon Dec 09, 2013 12:49 am

I've hit a brick wall guys any help please feel free to post
markmcn
 
Posts: 5
Joined: Sun Dec 08, 2013 12:48 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], hxnmdc and 22 guests