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

20th Apr 2018, 1:47 AM
chandrapal singh
chandrapal singh - avatar
6 Answers
+ 1
Yes, you can. Just install codeblocks for mac and compile.
20th Apr 2018, 1:58 AM
Akib
Akib - avatar
+ 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.
20th Apr 2018, 2:04 AM
Emma
+ 1
what is libraries ? what is standard and non- standard libraries?
20th Apr 2018, 2:09 AM
chandrapal singh
chandrapal singh - avatar
+ 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.
20th Apr 2018, 2:15 AM
Akib
Akib - avatar
+ 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.
20th Apr 2018, 2:29 AM
Emma
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.
20th Apr 2018, 2:18 AM
Akib
Akib - avatar