Hello
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
How-to specify the name of compiled output (*.exe) within C++ code?
Started by Panarchy, May 08 2009 11:00 PM
61 replies to this topic
#1
Posted 08 May 2009 - 11:00 PM
|
|
|
#2
Posted 09 May 2009 - 03:58 AM
You can't. The project file will tell the compiler what output name to use. If you ever use a different compiler, it will probably be the -o [outputname] option.
#3
Posted 10 May 2009 - 06:00 AM
I was just thinking, I could have 1 command prompt window open, and 1 Visual Studio main.cpp (or equivalent) open.
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
:D
Problem solved!
Disadvantages;
- Have to do an Alt-Tab :rolleyes:
- 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
Output File
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
:D
Problem solved!
Disadvantages;
- Have to do an Alt-Tab :rolleyes:
- 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
Output File
#4
Posted 10 May 2009 - 07:26 PM
There's an option in the Project settings called "Output Name" or something like that. You might want to take a look at that...
#5
Posted 11 May 2009 - 06:47 AM
Panarchy: that's how I code, except I use jEdit instead of VS.
#6
Posted 11 May 2009 - 01:11 PM
WingedPanther said:
You can't. The project file will tell the compiler what output name to use. If you ever use a different compiler, it will probably be the -o [outputname] option.
/OUT is the command. However, I can't get it to work. Some help here... please?
Thanks,
Panarchy
#7
Posted 11 May 2009 - 01:44 PM
dargueta may know. I don't use Visual Studio.
#8
Posted 12 May 2009 - 12:02 AM
Try this:
Notice that there are no spaces.
/OUT:programname.exe
Notice that there are no spaces.
#9
Posted 12 May 2009 - 04:38 AM
Hi
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
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
#10
Posted 12 May 2009 - 10:15 AM
Yep. You need to create two files aside from the icon, and add them to your project. Make sure you have one icon that's 32x32, optional ones are 16x16 and 48x48.
resource.h
resource.rc
Be sure you compile the project as a Win32 application, NOT a console application.
Win32 Programming (Tutorial on embedding/using resources is the second on the left)
resource.h
#define IDI_MYICON 101 #define IDI_SECONDICON 102
resource.rc
#include "resource.h" IDI_MYICON ICON "icon.ico" IDI_SECONDICON ICON "icon2.ico"
Be sure you compile the project as a Win32 application, NOT a console application.
Win32 Programming (Tutorial on embedding/using resources is the second on the left)
#11
Posted 12 May 2009 - 01:08 PM
Thanks, however the icon compiles properly and is embedded within the .exe, when doing the compiling via the GUI.
However, when using the aforementioned commands, I don't get an icon.
Can you please help me out here?
Thanks in advance,
Panarchy
However, when using the aforementioned commands, I don't get an icon.
Can you please help me out here?
Thanks in advance,
Panarchy
#12
Posted 12 May 2009 - 01:18 PM
An icon where, exactly? Do you want the icon to show as the program's thumbnail in Explorer, or in the upper left-hand corner? Please post your icon - it might have the wrong dimensions. (Also, make sure that both the resource files are added to your project.)


Sign In
Create Account


Back to top









