0

I do this now by running two commands.

C:\TC\Bin>tcc test.cpp
C:\TC\Bin>test

Is there any way to accomplish this by using just one command?

MSalters
  • 173,980
  • 10
  • 155
  • 350

1 Answers1

1

As Basile Starynkevitch said you could write a batch file... This version has error checking for compile errors...

@Echo off tcc test.cpp if errorlevel 1 goto FAILED test.exe

:FAILED

As your project gets more complicated consider using MAKEFILE's

Anonymouse
  • 935
  • 9
  • 20
  • Might want to add `goto :EOF` after `test.exe` – anatolyg Nov 26 '14 at 12:43
  • why? If compilation fails it goto's eof, if compile is ok the command line will read, parse and ignore the :FAILED label... So no need – Anonymouse Nov 27 '14 at 09:53
  • To prevent execution of stuff after `:FAILED` on successful compilation. It's a pretty standard practice in bat-files. – anatolyg Nov 27 '14 at 12:04
  • errr????? there is NO stuff after FAILED... The purpose of going to FAILED is to skip the TEST.EXE line, so no attempt to execute a failed compile takes place (actually it will be the last successful version of the EXE). What would you suggest any code after FAILED does, clear the screen so you can't see the error messages???? The batch file as shown will work perfectly for what the questioner asked for. – Anonymouse Nov 27 '14 at 14:55
  • 1
    This was a misunderstanding - I thought you intended to have additional stuff there. You are right - it will work as is. – anatolyg Nov 27 '14 at 15:11