How-to specify the name of compiled output (*.exe) within C++ code?Using Visual Studio 2008
32 Replies - 2273 Views - Last Post: 03 June 2009 - 03:09 PM
#1
How-to specify the name of compiled output (*.exe) within C++ code?
Posted 09 May 2009 - 12:01 AM
How can I specify the name of the compiled output (the .exe) within my C++ code?
I'm using Visual Studio 2008.
Please tell me if this is possible, and if it is, how to do so.
Thanks in advance,
Panarchy
Replies To: How-to specify the name of compiled output (*.exe) within C++ code?
#2
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 09 May 2009 - 12:05 AM
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("The name of the exe is : %s\n\n",argv[0]);
return 0;
}
#3
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 09 May 2009 - 12:14 AM
Forgive my ignorance, the compiled output, the .exe, which part of the above code is it specified in?
Is it the %s\n\n or something else?
Please explain it to me.
Thanks in advance,
Panarchy
#4
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 09 May 2009 - 12:16 AM
#5
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 09 May 2009 - 12:21 AM
cout << argv[0] << endl << endl;
the '%s' is a string, (argv[0] in this case)
and the two '\n's are newline characters
#6
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 09 May 2009 - 01:13 AM
#7
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 10 May 2009 - 05:35 AM
PrintF was confusing me, well, I'll check the link now. So thanks to both of you!
#8
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 10 May 2009 - 06:54 AM
I could then make the changes to the code, Alt-Tab to the command-prompt window, then put in what I want the .exe to be via the /out parameter.
Advantages;
- No extra code needs to be added
- So the size of my program won't enlarge
Problem solved!
Disadvantages;
- Have to do an Alt-Tab
- Command-Prompt sucks, as I need to right-click, Paste
Though I still would like to know if this can be done programmatically, it is no longer a priority.
If you know how I can get this to be done programmatically, please tell me.
Thanks in advance,
Panarchy
Links:
/OUT http://msdn.microsof...y/8htcy933.aspx
Output File: http://msdn.microsof...outputfile.aspx
#9
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 10 May 2009 - 07:00 AM
So say you're always getting a.out.exe and you want program.exe
#10
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 10 May 2009 - 07:23 AM
I will be making slight changes to the code, then recompiling the program more than 250 times, so the fastest way possible, with the smallest input is what I am looking for.
So a line or two of code that specifies the outfile, would be... bearable. (least # of KB added to the end is what I'm looking for)
Thanks in advance,
Panarchy
#11
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 10 May 2009 - 09:20 AM
#12
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 10 May 2009 - 03:18 PM
Thanks,
Panarchy
#13
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 11 May 2009 - 07:15 PM
I've worked it out, first I need to do a;
cl /clr "test.cpp"
Then
Link "Test.obj" /out:"testing.exe"
There is one problem with this though, that is it doesn't give me an icon.
Doing it manually using the GUI, it does include an icon.
So any ideas on how I can embed the icon via the CLI?
Thanks,
Panarchy
#14
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 14 May 2009 - 03:07 AM
First, I'd like to be able to do this via the Visual Studio Command-Prompt.
Currently I'm using the following commands;
cl /clr "super.cpp"
rc super-resource.rc
link "super.obj" /ASSEMBLYRESOURCE:super-resource.res /out:"Not Super.exe"
The above compiles the program, with the same size as when I compile the .exe using the GUI, HOWEVER, there are no icons.
Please tell me how to get this to work.
Thanks in advance,
Panarchy
This post has been edited by Panarchy: 14 May 2009 - 03:07 AM
#15
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Posted 14 May 2009 - 01:10 PM
|
|

New Topic/Question
Reply




MultiQuote





|