CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

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

    Well, the idea is that .cpp is not a correct place for holding resource descriptions and build settings. That's why resource scripts, makefiles and/or project files exist.
    Best regards,
    Igor

  2. #17
    Join Date
    Aug 2007
    Posts
    858

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

    Quote Originally Posted by Panarchy View Post
    Thanks, but how do I put that line directly into the .cpp file?
    You can't. Exe output is generated by the linker, and the linker never sees your source code.

  3. #18
    Join Date
    Nov 2007
    Posts
    92

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

    Would it be possible, to use argv to specify the name of the .exe within my code?

    Is that possible?

    Thanks

    Panarchy

  4. #19
    Join Date
    Aug 2007
    Posts
    858

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

    No. Argv is used with the program runs. After the exe has already been created and named.

  5. #20
    Join Date
    Nov 2007
    Posts
    92

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

    Ah.

    Well, thinking outside the square, could I put some kind of copy/rename program/line to run as soon as program finishes compiling?

  6. #21
    Join Date
    Aug 2007
    Posts
    858

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

    You do know that you can specify the name of the exe in your project settings, right? You can set up your project to do post-build actions though, if that's what you really want/need.

  7. #22
    Join Date
    Nov 2007
    Posts
    92

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

    Okay, but how do I specify the post-build actions within the actual code?

  8. #23
    Join Date
    Nov 2007
    Posts
    92

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

    Hello Again!

    I still haven't worked out how to do this .

    Could someone please tell me how to set the name of the *.exe programmatically?

    More info: http://msdn.microsoft.com/en-us/libr...utputfile.aspx

    Please help me do this!

    Thanks in advance,

    Panarchy

  9. #24
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

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

    Quote Originally Posted by Panarchy View Post
    Could someone please tell me how to set the name of the *.exe programmatically?

    More info: http://msdn.microsoft.com/en-us/libr...utputfile.aspx
    I wonder if you really read the "more info"? This article has nothing to do with the thread's topic. Because this is about how to write VisualStudio extension that can set the name of compiled exe.

    Really more info:
    Code:
    // 503.cpp
    #pragma comment(linker, "/out:mycool.exe")
    
    int main()
    {
    	return 0;
    }
    Code:
    E:\Temp\503>cl 503.cpp
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
    Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
    
    503.cpp
    Microsoft (R) Incremental Linker Version 7.10.3077
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    /out:503.exe
    503.obj
    503.obj : warning LNK4070: /OUT:mycool.exe directive in .EXP differs from output filename '503.exe'; ignoring directive
    ...but

    Code:
    E:\Temp\503>cl 503.cpp /c
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
    Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
    
    503.cpp
    
    E:\Temp\503>link 503.obj
    Microsoft (R) Incremental Linker Version 7.10.3077
    Copyright (C) Microsoft Corporation.  All rights reserved.
    Last edited by Igor Vartanov; May 24th, 2009 at 02:55 AM.
    Best regards,
    Igor

  10. #25
    Join Date
    Nov 2007
    Posts
    92

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

    I got the same;
    Code:
    1>------ Build started: Project: VNC, Configuration: Release Win32 ------
    1>Compiling...
    1>stdafx.cpp
    1>Compiling...
    1>VNC.cpp
    1>Compiling resources...
    1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
    1>Copyright (C) Microsoft Corporation.  All rights reserved.
    1>Linking...
    1>VNC.obj : warning LNK4070: /OUT:mycool.exe directive in .EXP differs from output filename 'C:\VNC\Release\VNC.exe'; ignoring directive
    1>Generating code
    1>Finished generating code
    1>Embedding manifest...
    1>Build log was saved at "file://c:\VNC\VNC\Release\BuildLog.htm"
    1>VNC - 0 error(s), 1 warning(s)
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

  11. #26
    Join Date
    Nov 2007
    Posts
    92

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

    *bump

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured