Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 8-Feb-13 8:15am
hor_313630
Edited 8-Feb-13 20:52pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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. Smile | :)
For now you could look at Java or Mono but if C++ is your thing then road is harder but the end is better.
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 8-Feb-13 14:23pm
   
Nice reply, a 5.
—SA
hor_313 at 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 at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 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 at 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 at 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 at 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 at 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.
hor_313 at 9-Feb-13 0:44am
   
then if i write the program in c++ native and standard code or i write it in mono or other cross-platform frameworks , running speed in both(when user using it) is equal?
H.Brydon at 9-Feb-13 0:59am
   
No, that is a different question. The answer to that is very complex and not realistic to answer in the small space we have here. Generally I would expect the mono environment to be slower than native, but there will be exceptions and variability depending on a lot of things not considered here.
 
tl;dr: That question is far beyond the scope of what we can describe here.
hor_313 at 9-Feb-13 1:16am
   
i want to work on image processing and artificial intelligence field and generally robot programming.
but i dont know which IDE , which compiler and which OS is best for me .
i see the newest mini-computers have ARM processors and they have android opration system. but in large projects we have intel processors and linux or windows os .
i am confused :(
H.Brydon at 9-Feb-13 1:25am
   
How experienced a programmer are you? Your questions suggest that you are a novice C++ programmer. If you want to be multiplatform, I'd suggest learning java instead of C++. It is a different planet from C++ but has most or all of the things you cite here and the UI features will translate without a lot of trouble.
hor_313 at 9-Feb-13 1:48am
   
no java isn't real-time language and its slow for image processing for robatic . and also i think it doesn't support open-cv library or some like this .
and for system port programing or microcontrollers programing java isn't a good choice
 
my focus is in that things i said above , but i like do everything by c++ like GUI programing.

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

  Print Answers RSS
0 OriginalGriff 480
1 Maciej Los 330
2 Richard MacCutchan 225
3 BillWoodruff 185
4 Suraj Sahoo | Coding Passion 155
0 OriginalGriff 8,759
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,269
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411028.1 | Last Updated 9 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100