Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
is it possible?

i want to coding in VS but i can run it in linux , android or anywhere , how it will be possible?
Posted
Updated 8-Feb-13 19:52pm
v2

At the moment this is very hard in C++. Some people have said it is impossible which is not correct but it requires very deep knowledge of what is the same and what is different between Windows and Linux and Android etc.
I have been working on this exact issue and have solved many of the problems over 10 years but the solution is not yet complete. If you search for my article "Introduction to the QOR" on Code Project articles or for QOR on SourceForge you will find what I have published so far which includes a very small test program that will build and run on Windows and Linux with seven different compiler/IDE combinations. Almost all of this except for the projects to build under other IDEs was written in Visual Studio. Building on one system for another kind of system is called cross-compiling. Visual Studio cannot do this for Linux so I build on Linux for Linux and for Windows on Windows but the code is the same and comes from a shared network drive.
In the near future it will be possible to build one application in just C++ and build and run it on Linux, Windows, Android, OSX in 32bit and 64bit versions, with the compiler of your choice and if you want to write all the code in Visual Studio you can. This is the dream and I know how to achieve it but I only have 10 fingers and 24 hours in the day. :-)
For now you could look at Java or Mono but if C++ is your thing then road is harder but the end is better.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 8-Feb-13 14:23pm    
Nice reply, a 5.
—SA
hor_313 8-Feb-13 22:24pm    
thanks for reply.
but i mean that i am seeking a solution that i can write a standard c/c++ code that could runs in any platforms.i dont know i should use from ATL or Win32 or othrs in VS to reach that target
Matthew Faithfull 9-Feb-13 3:20am    
Sadly although there is a C++ standard there is no standard C++. If you want to run acrsoss platforms you cannot use Win32 or ATL/WTL or MFC or language extensions or SAL enhanced headers directly at all. This is the problem. Even the C library and the 'standard' library are not quite the same on different platforms. You can use most of that but things still have to be fudged very carefully to make them work. If you're doing a GUI then it has to be Qt or GTK+ or Foxlib or something like that to work on just a few platforms.
Any console app (ie. no UI) that just links to the crt libraries should run on any platform. The source should be universally compatible but it will require a separate compile for each platform.

If you want to use a 'universal UI' you will need to change to another language such as java. Visual Studio will not help you with that detail.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 8-Feb-13 14:25pm    
Well, almost, I would say. I also depends on the content to be calculated out to be presented in this console, quite apparently. Good point anyway, a 5.
—SA
hor_313 8-Feb-13 21:53pm    
can you more explain about : it will require a separate compile for each platform.

i dont understand it. how can i implement it?

if i write a program and then anyone wants to use it on some platforms , in every usage or run , it will be compiling such as first time?

i dont understand this part
H.Brydon 8-Feb-13 23:02pm    
For example, on Windows, you can compile the source either within the Visual Studio IDE, or on a properly initialized command line using "CL" and "Link" commands (or variations).

On linux, you will need to establish a compile time environment and compile the code with "GCC" (or equiv). The source code would (optimistically) be the same as for Windows.

On any other platform, you need to acquire the C++ compiler for that system and compile your source.
hor_313 9-Feb-13 0:31am    
this compile is just for programmer and when he is writing the code or it will be happen everytime users run the program ? (i mean the future users of the program after publishing .... i mean the program is written by this approach will be slower than because they have twice compile in runtime? )
H.Brydon 9-Feb-13 0:35am    
You the programmer (or another programmer) need to compile your code once for each platform. You then take the compiled target(s) and run it yourself and/or distribute to users. You do not usually distribute the source code to end users.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900