0
Can i run c++ file in other computer
if i made a code in windows and compile in mac then can i use in mac. i mean i have a source file of c++ then can i run it on any device.If no , then what is the solution how can i run c++ code in my other devices
6 Answers
+ 1
Yes, you can. Just install codeblocks for mac and compile.
+ 2
If you use the standard C++ libraries it is far more likely to compile on other devices.
If you've used non-standard libraries, then your chances are low.
Java is usually a better bet, as it's intended to be device-independent / cross-platform.
+ 1
what is libraries ?
what is standard and non- standard libraries?
+ 1
unofficially - Libraries are codes which stores functions that you use in your program. Like cout,cin these are pre programmed in those library files.
Standard library is what the compiler/IDE comes with.(Functions that are previously programmed)
non- standard is what you make.(Yes you can make libraries/header files)
You can add them with #include and use the functions you wrote inside.
+ 1
Libraries are standalone chunks of functionality, which are brought in using #include statements.
Standards libraries are ones like the list library. Code using that library should work on all compliant versions of C++.
https://en.wikipedia.org/wiki/C%2B%2B_Standard_Library
Non-standard are usually platform dependent libraries like some graphics libraries. Any code that uses non-standard libraries, will usually need to be rewritten if you move platform. However, most people don't move platform.
The design process would include language choice. If you think now or the future, the code needs to run on multiple platforms, then you choose the right language (Java etc), or at least loosely couple your code that uses non-standard libraries with the rest of the code.
0
Wiki-
In the C++ programming language, the C++ Standard Library is a collection of classes and functions, which are written in the core language and part of the C++ ISO Standard itself.