The Project Build Options dialog box appears.Ĥ. Some huge projects require multiple libraries.Īfter creating the Code::Blocks project, follow these steps to add a library: And you can follow the steps to link in any library, not just the math library. You don’t have to on a Mac or PC, but these are the steps you would use. In Code::Blocks, things work differently.Īs an example, suppose you need to link in the math library in a Code::Blocks project. On the command line, you use the -l x switch to link in library x. The library is what contains the code that makes the functions work. The header file, however, is not the same as the library. The library also comes with a header file that provides function definitions, constants, structures, and other whatnot. You must specify that such a library is linked into the final program. The standard library is linked by default, but pretend that you’re using a library that creates graphics, sound, or provides other specific functions beyond the normal scope of C. More importantly, to expand the C language’s capabilities, you frequently need to mix in another library. I’ve not installed Code::Blocks on a Linux computer, but for a moment I’ll pretend that such an installation has the same issue I described in last week’s Lesson: You must manually link in the C language math library to create any program that uses a math.h function.
0 Comments
Leave a Reply. |