1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

How-to specify the name of compiled output (*.exe) within C++ code?

Discussion in 'C++' started by Panarchy, May 9, 2009.

  1. Panarchy

    Panarchy New Member

    I think you are speaking about the GUI method.

    When compiling using the GUI, the icon is there.

    I'm trying to compile the program via the command-line.

    I've been able to get the program to work, however I can't get the icon to show up.

    Any ideas?

    Thanks in advance,

    Panarchy
     
  2. Panarchy

    Panarchy New Member

    I got it to work by using the .res at the linking stage.

    :D

    So I've now successfully worked out how to compile, the program via command-prompt, specifying the name, and having the correct icon.

    Thanks for all your help.

    Now, any ideas on how I can do this within my C++ code?

    Thanks in advance,

    Panarchy
     
  3. xpi0t0s

    xpi0t0s Mentor

    Great stuff! What were the final commands you used?

    Assuming you mean how can you get an icon using pure C++ code without any resources: You can't. Resources can be made programmatically and there is support in the WinAPI for that, but the way Windows draws an icon is by looking in the executable for icon resources. If you want to animate an icon like the way AVG modifies its tray icon, or the way Privoxy does the radar thing when loading a page, etc, then you do that with multiple icon resources and specify at runtime which resource is the current system tray icon or whatever.
     
  4. Panarchy

    Panarchy New Member

    link super-resouce.res main.obj
     
  5. Panarchy

    Panarchy New Member

    So... any idea how I can specify the name within the C++ code?

    Thanks in advance for any help,

    Panarchy
     
  6. Panarchy

    Panarchy New Member

  7. xpi0t0s

    xpi0t0s Mentor

    Could you give a detailed description of the problem you're trying to solve?
    In particular I'd like to understand why the approach I suggested before won't work, i.e. specifying the name of the executable at the command line and scripting the generation of the executables.
    i.e.
    Code:
    cl prog.c -Dprog1_options -o prog1.exe
    cl prog.c -Dprog2_options -o prog2.exe
    cl prog.c -Dprog3_options -o prog3.exe
    
    and in the code
    Code:
    #ifdef prog1_options
    // do the prog1 stuff
    #endif
    
    #ifdef prog2_options
    // do the prog2 stuff
    #endif
    
    // etc
    
     
  8. xpi0t0s

    xpi0t0s Mentor

    The page reference leads to documentation on Customizing and Automating the Development Environment and for help with this I would recommend using the appropriate Microsoft newsgroups, you're more likely to find someone who will help you with this over there.
     
  9. Panarchy

    Panarchy New Member

    But this forum has been so helpful in the past...
     
  10. xpi0t0s

    xpi0t0s Mentor

    And my other post (about a detailed description...)?
     
  11. Panarchy

    Panarchy New Member

    Are you talking about your scripted example?

    No, thanks, but I'd prefer to do this within the code... or even, thinking outside the square, to edit the script from within my C++ code and also have it run after code is compiled...

    Would that be possible?
     

Share This Page