Code::Blocks Forums
User forums => General (but related to Code::Blocks) => Topic started by: mahaju on December 09, 2011, 01:06:27 pm
-
Hello everyone
I am using Codeblocks 8.02 in Puppy Linux
I have gcc and GMP library installed
When I compile a program that GMP header file through the command line, I need to invoke the GMP library by giving this command
gcc -o oufile codefile.c -lgmp
How do I set the -lgmp parameter if I want to compile my program from codeblocks?
Thanks in advance
-
How do I set the -lgmp parameter if I want to compile my program from codeblocks?
Create a project, go to the linker tab in the project options, add "gmp" as linker library.
I also suggest you consult the C::B manual for some screenshots:
http://www.codeblocks.org/docs/main_codeblocks_en.html
-
Hi
When I try to add new files to a project it shows a box saying adding files to the project and then sort of stops there
Here's a screenshot
What is the problem here?
PS: I am running this in VMWare
[attachment deleted by admin]
-
I cannot say whether or not this is the problem, however I would suggest you try updating Code::Blocks to at least version 10.05 (8.02 is quite old, and many features have been fixed/added since then).
-
Thank you for the reply
however, I found out how to solve this particular problem
Just ignore the dialogue box that appears in the front, click on the one in the back and check the debug and/or release check boxes and press OK
Also I was not able to figure out how to get Codeblocks 10 for Puppy Linux 5.2.8 so I am using this one, since it is available as .pet package in the forums
-
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
-
1. I guess you mean compiler properties and not the project properties?
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.
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.
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.
-
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