Results 1 to 7 of 7

Thread: g++: error: missing argument '-l'

  1. #1
    Join Date
    Feb 2013
    Beans
    5

    Question [SOLVED] g++: error: missing argument '-l'

    So here is the thing. I installed ubuntu yesterday in my netbook cause it came with windows by default. I love programming altought it is not my job. I like making games and i do it with the Allegro library. So I instaled codeblocks, compiled the library added the links in codeblocks an tested it out. So I tried making a simple allegro display but when i try to compile it says:

    g++: error: missing argument '-l'

    This might be a very noobish question but it was the first timed this append to me. If you need any more informationt that could help you help me say what you need and i'll give it to you

    A big thanks in advance.
    Last edited by lockandstrike; March 2nd, 2013 at 01:39 PM.

  2. #2
    Join Date
    Jan 2013
    Beans
    25

    Re: g++: error: missing argument '-l'

    try g++ -o hello hello.cpp on the command line where hello is your executable and hello.cpp is the file you wanted to compile.

  3. #3
    Join Date
    Feb 2013
    Beans
    5

    Re: g++: error: missing argument '-l'

    I know I should have said this earlier but I'm doing it on codeblocks and it's a .c source file. So I realy dont know whats wrong.

  4. #4
    Join Date
    Apr 2012
    Beans
    7,256

    Re: g++: error: missing argument '-l'

    Are you sure it doesn't say

    Code:
    missing argument to `-l'
    That would indicate that you've tried to specify a library to link against, but omitted the actual library name:

    Code:
    $ cat >mytest.c <<EOF
    > #include <stdio.h>
    > #include <math.h>
    >
    > int main(void)
    > {
    >   double x = M_PI/4.0;
    >
    >   printf("sin %f = %f\n", x, sin(x));
    >
    >   return 0;
    > }
    > EOF
    $ gcc -Wall -o mytest mytest.c -lm
    $ ./mytest
    sin 0.785398 = 0.707107
    $ gcc -Wall -o mytest mytest.c -l
    gcc: error: missing argument to `-l'
    $
    I don't use codeblocks, but you should find where the build options are defined and check the library / linker sections

  5. #5
    Join Date
    Feb 2013
    Beans
    5

    Re: g++: error: missing argument '-l'

    Thanks. It is:
    g++: error: missing argument to '-l'
    But how do i specify the library name? i only know how to link

  6. #6
    Join Date
    Feb 2013
    Beans
    5

    Re: g++: error: missing argument '-l'

    Any help would be helpfull

  7. #7
    Join Date
    Feb 2013
    Beans
    5

    Re: g++: error: missing argument '-l'

    Thanks to everybody who helped but i figured out what was wrong. Now it's all working like i wanted.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •