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"

I have used the following alias and it worked well.

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

The first does not work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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