Compile and Run individual files ?

General questions regarding the usage of CodeLite
Bamboo
CodeLite Curious
Posts: 3
Joined: Mon Jul 19, 2010 1:16 pm
Genuine User: Yes
IDE Question: C++
Contact:

Compile and Run individual files ?

Post by Bamboo » Mon Jul 19, 2010 1:26 pm

I have a question: Can CodeLite compile and run individual files (just Open them) which don't need to be in a project or workspace ?
Thank you very much!

User avatar
eranif
CodeLite Plugin
Posts: 5942
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Compile and Run individual files ?

Post by eranif » Mon Jul 19, 2010 1:49 pm

You can define a tool for such task using the 'external tools' plugins

from the menu: Plugins -> External Tools -> Configure tools

create new tool

Name: compile single file
Tool path: g++
Arguments: $(CurrentFileFullPath) -o myexe -g
and check the options: Capture output process

This tool will simply compile the active file using the pattern g++ '$(CurrentFileFullPath) -o myexe -g'

You can define a shortcut for this tool using the 'settings -> keyboard shortcuts' and search for the external_tool_N entry

You can also simply run it from the toolbar or from the plugins menu

Eran
Make sure you have read the HOW TO POST thread

Bamboo
CodeLite Curious
Posts: 3
Joined: Mon Jul 19, 2010 1:16 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Compile and Run individual files ?

Post by Bamboo » Mon Jul 19, 2010 2:00 pm

Thanks for responding :D
But I think all the files will have the same name "myexe", aren't they?

Beside, if I just open 1 file by CodeLite and run it by that tool, I always have the msg

Code: Select all

g++: $(CurrentFileFullPath): No such file or directory
g++: no input files
Program exited with return code: 1

User avatar
eranif
CodeLite Plugin
Posts: 5942
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Compile and Run individual files ?

Post by eranif » Mon Jul 19, 2010 3:15 pm

Which version of codelite are you using?

Eran
Make sure you have read the HOW TO POST thread

Bamboo
CodeLite Curious
Posts: 3
Joined: Mon Jul 19, 2010 1:16 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Compile and Run individual files ?

Post by Bamboo » Mon Jul 19, 2010 5:26 pm

I'm using v 2.5.2.4031
The problem happens when I trying to compile individual file with no workspace opened

Post Reply