473,406 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

VC++.net, C# - How to set executable name from code

1
Hello all
Does anybody know how to set the output file (*.exe) name from with within the source code? I have an application that I would like to compile into two different executables. It is basically a client/server application, built with VC++.net Express edition, and the code for the client and server are so similar that I am using a single project and a #define statement to switch between the client and server outputs. And yes, they do need to be different executables.
I have attempted to do this by setting the (/OUT:[file]) linker option as shown below. I get a LNK4070 error when attempting to compile this and get the message "EXP differs from output filename".

#define CLIENT

#if defined( CLIENT )
#pragma comment(linker, "/OUT:\"C:\\Projects\\MyProject\\Client.exe\"")
#elif defined( SERVER )
#pragma comment(linker, "/OUT:\"C:\\Projects\\MyProject\\Server.exe\"")
#endif

The documentation for the /OUT linker option says that it should overwrite the output file name set in the project properties but this doesn't seem to be the case.

Or perhaps I am taking the wrong approach here. Does anybody knwo if there is a .NET method of changing the output executable name from within the code? If you know how this is achvieved in C# or VB.net please let me know and I will convert it to VC++.net.

Daniel
Nov 23 '07 #1
0 1008

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Scott Chang | last post by:
Hi all, I loaded the following program 'HelloMCPP' to my MS VC++ .NET (2002) that is installed on my Windows XP Professional PC: ------------------------------------- AssemblyInfo.cpp...
4
by: RajW | last post by:
Is it possible to make VC.NET 2003 produce an MS DOS (no Windows) executable? If so how? I was able to get it to produce an MS DOS executable, but when I copied the file to a plain DOS (legacy)...
5
by: Scott Chang | last post by:
Hi all, I copied a set of VC++ version 6 source code of the 'cppdll'(2 projects) from a website and put the cppdll.cpp, cppdll.def, cpp.h, (as the 1st project) and test.cpp (as the 2nd project)...
0
by: Peter Steele | last post by:
We have a build script that uses any to compile our .NET VC++ projects. A typical target looks like this: <target name="MyProj"> <exec executable="devenv"> <arg line= "MyProj.vcproj /build...
4
by: Alex | last post by:
Hi there I'm switching from VC++ 6.0 to VC++ .NET 2003. Since there is no stand-alone version of VC++ .NET 2003 Pro, I went and purchased the Standard version, which does not have an...
2
by: DavideR | last post by:
How to launch a exe in a vc++ 2002 program? What is the equivalent of vb6's app.path? How can i get the exe name? Thanks davide
1
by: Eric | last post by:
I have 2 projects in a VC 6.0 workspace. One is a C++ static library. The other is an executable that is dependent on the static lib. In the Linker options for the executable, I have included the...
16
by: John | last post by:
Does the length of my C variable names have any affect, performance-wise, on my final executable program? I mean, once compiled, etc., is there any difference between these two: number = 3; n =...
0
by: ppuniversal | last post by:
I am making a client server application in VC++ 2005. It compiles correctly with 0 errors. But when I execute the executable file say GridServer.exe, it gives the following error : The...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.