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.
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Quote:
Originally Posted by
Panarchy
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.
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
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.
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?
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.
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?
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
Re: How-to specify the name of compiled output (*.exe) within C++ code?
Quote:
Originally Posted by
Panarchy
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.
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 ==========
Re: How-to specify the name of compiled output (*.exe) within C++ code?