User forums > General (but related to Code::Blocks)

link GMP library when using codeblocks

<< < (2/2)

mahaju:
Hello everyone
Please don't mind, but I have a few questions for Mr McFly
1. I guess you mean compiler properties and not the project properties?
2. Although it's not directly related to codeblocks, kindly tell me how to do something similar to adding -lgmp, but with my own library, in Windows. That is, I want to link to a library that I compile, in Windows through the command line. If possible please give me some ideas on this. One more thing, the --help parameter in gcc does not show -lgmp (nor -l), but it still works. Is there a complete list of all the parameters of gcc, possibly with some simple to understand explanations (and by this I mean besides the gcc website)? What is the gcc option that allows linking (for example, -S gives me the assembly file, -c gives me the object file after assembly but does no linking, so I still don't get an executable, and not specifying anything seems to do all 3 steps, create assembly file, create object file and link everything together to get an executable. So I if I have to do these steps individually, how to I do the linking part? )
Please don't mind even if these questions are not exactly codeblocks specific
Thank you for your time

MortenMacFly:

--- Quote from: mahaju on December 28, 2011, 08:26:43 am ---1. I guess you mean compiler properties and not the project properties?

--- End quote ---
Yes, through the project options, you can also get to the build options, which include compiler and linker options. So it's always a good starting point.


--- Quote from: mahaju on December 28, 2011, 08:26:43 am ---2. Although it's not directly related to codeblocks, kindly tell me how to do something similar to adding -lgmp, but with my own library, in Windows.

--- End quote ---
You should try to understand / read yourself into how a compiler an linker works. Basically it's always the same for the linker: It needs to know where the library is (that's what the include directories for the linker are for), how the library is called and in which order it is required to link against.

The linker option -L[FOLDER] is an equivalent to adding directories to the linker include folders in C::B. No need for "-L". The linker option -l[library name] is an equivalent for adding the library to the linker options to link against. No need for the "-l".

I always strongly recommend before starting to use an IDE do such stuff on the command line to understand the principles of compilation / linking. And IDE won't help you to teach this, it helps you in case you already know what to do to easily set it up.

mahaju:
Thank you very much
I have sorted out most of my problems related to linking an external library, but few issues are still remaining and I am looking into them
I hope I can drop in here later if I have any other problems
Thank you for your help

Navigation

[0] Message Index

[*] Previous page

Go to full version