Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using this code

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
up vote 2 down vote accepted

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

So your code would look like this;

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .