Monday, July 27, 2009

How do you link cpp files, i mean c++ a.out files ,?

Assuming we are talking unix/linux, if you have made an a.out file you *have* linked. a.out should be executable.





When you compile with the -c option you just compile without linking and general produce a ".o" file.





If you want a.out to be name something other than a.out then you need to use the -o option.





g++ -o myprog myprog.cpp will produce an executable named myprog instead of a.out


No comments:

Post a Comment