Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using this code

cd "$(CURRENT_DIRECTORY)"
g++ $(FILE_NAME) -o $(FILE_NAME).exe

to run a cpp from notepad. What I had expected to run was g++ FILE_NAME.cpp -o FILE_NAME.exe But g++ FILE_NAME.cpp -o FILE_NAME.cpp.exe is what I got.

So how do I include only the file name (without the extension) so that this code works? Is there some code to access the file name (without the extension)?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The environment variable $(NAME_PART) should just return the filename without file extension.

So your code would look like this;

cd "$(CURRENT_DIRECTORY)"
g++ $(NAME_PART) -o $(NAME_PART).exe
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.