Hi, i need some help here I've a C++ source code that i compiled on Linux, but when i pass the binary files to my friend whom are using MAC. He said that he couldn't run the binary files, he needs to recompile it on his MAC then he is able to run the code. Is there any way so the binary files from Linux can run directly on MAC without recompiling it again? Can someone guide me, pls? Thx Below is my code : #include <stdio.h> #include <stdlib.h> #include <iostream> #include <fstream> #include <unistd.h> using namespace std; int main() { const char *filePath = "/usr/share/ss/myfile.txt"; char *msg; if(remove(filePath) != 0) { msg = "Uninstallation Unsuccessful, Please Contact Admin"; cout << msg << endl; cout << "Press [Enter] to continue" << endl; cin.get(); return 1; } else { msg = "Uninstallation Successful"; cout << msg << endl; cout << "Press [Enter] to continue" << endl; cin.get(); return 1; } return 0; } Code (markup):
Couldn't you just give him the project file? Go to where your project is located and try giving him the entire folder's worth of files. It should work, otherwise let me know and I'll get to the bottom of it
Rrrr, actually. We will need the binary files to be included in our installer file It has to be general, so when user run the file. It will delete the installation folder, no matter user run on Linux or Mac platform. Does binary files that is compiled on Linux cant run on Mac? Pls give me advice, thx. We are doing our final year project
MAC, Linux and Windows all compile into different code so you would have to recompile every time. The best thing you can do is PImpl your code to make it compile faster. P.s. You shouldnt use "using namespace" as it dilutes the current namespace You probably only need half those header files.
nope your MUCH better off prefixing those functions with std:: it has the same effect but with some noticeable differences. Firstly the namespaces arent polluted with functions you dont need and secondly when you look at the code again after 6 months youll know that they are std functions rather than other functions it also helps greatly when you start creating large projects with many namespaces in! just good practices to get into dude!
That C code looks like it could be duplicated in a simpler scripting language for each platform. Perhaps that could simplify things?
Why not just copy the source code to a text file, send him the text file, and then have him compile it on Linux?