Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create an alias on ubuntu for the bellow commands:

g++ -lSDL -lSDLmain -lSDL_image -lGL -lGLU src.cpp -o a.out
g++ -lGL -lglut `sdl-config --cflags --libs` src.cpp -o a.out

When I execute them in the terminal all goes very well, but if I create aliases for them I find the following error:

/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o(.text+0x18): error: undefined reference to 'main'
collect2: ld returned 1 exit status
bash: -L/usr/lib/i386-linux-gnu: No such file or directory

The aliases are:

alias g++="g++ -lGL -lglut `sdl-config --cflags --libs`"
alias gcpp="g++ -lSDL -lSDLmain -lSDL_image -lGL -lGLU"
share|improve this question
up vote 1 down vote accepted

I have used the following alias and it worked well.

alias g+++="g++ -lSDL -lSDLmain -lSDL_image -lGL -lGLU"

The first does not work.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.