User forums > Using Code::Blocks

Code:Blocks 10.05 + Allegro + Linux

(1/2) > >>

hyrob:
For one week I've been trying to get Code:Blocks compile an allegro c++ program. However having treid both linker options :
'allegro-config --libs --static'
$(allegro-config --libs --static)

I did not make much progress. So I went to the console and compiled the program with no problem using the following :
g++ myprogram.cpp -o myprogram $(allegro-config --libs --static)

After trying such structure of the command :
g++ $(allegro-config --libs --static) myprogram.cpp -o myprogram
exactly the same errors appeared as in Code:Blocks.

What to do to make Code:Blocks put linker options at the back of the command.

P.S. I also tried putting the $(allegro-config --libs --static) in different linker and compiler options, with no luck.
I should also mention that without any options my c++ programs compile in Code:Blocks with no problems.

Please help

stahta01:
The tick you used in the post is NOT the correct tick mark.

I think it is ` ; but, I might be wrong.

Tim S.

Jenna:
As Tim writes:
use backticks ("`" aka. grave accent) around the command.
That should also work on console.

The settings for the linker (--libs) belong to "Project -> Build options -> [Project and/or target] -> Linker settings -> Other linker options:",
the settings for the compiler (--cflags or --cppflags or whatever is supported) belong to "Project -> Build options -> [Project and/or target] -> Compiler settings -> Other options:" .

hyrob:
Yes, you are right about the grave accent, and console confirms it nicely.

But the "`" did not help and I am still getting :

Compiling: /home/hyrob/allegroproject1.cpp
/bin/sh: Syntax error: ")" unexpected
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings
 
In console however there are many mistakes, just as if it does not find the allegro library

hyrob@desktop-hyrob:~/$ g++ `allegro-config --libs --static` allegroproject1.cpp -o allegroproject1
/tmp/ccrl5HnB.o: In function `main':
allegroproject1.cpp:(.text+0x4b2): undefined reference to `_install_allegro_version_check'
allegroproject1.cpp:(.text+0x4bc): undefined reference to `set_color_depth'
allegroproject1.cpp:(.text+0x4db): undefined reference to `set_gfx_mode'
allegroproject1.cpp:(.text+0x4e0): undefined reference to `install_keyboard'
allegroproject1.cpp:(.text+0x4e7): undefined reference to `screen'
allegroproject1.cpp:(.text+0x50e): undefined reference to `rest'
allegroproject1.cpp:(.text+0x53c): undefined reference to `screen'
allegroproject1.cpp:(.text+0x559): undefined reference to `rest'
allegroproject1.cpp:(.text+0x560): undefined reference to `screen'
allegroproject1.cpp:(.text+0x5a9): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x5b2): undefined reference to `screen'
allegroproject1.cpp:(.text+0x5da): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x5e3): undefined reference to `screen'
allegroproject1.cpp:(.text+0x60b): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x62d): undefined reference to `gfx_driver'
allegroproject1.cpp:(.text+0x639): undefined reference to `gfx_driver'
allegroproject1.cpp:(.text+0x659): undefined reference to `gfx_driver'
allegroproject1.cpp:(.text+0x665): undefined reference to `gfx_driver'
allegroproject1.cpp:(.text+0x683): undefined reference to `screen'
allegroproject1.cpp:(.text+0x6aa): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x6b3): undefined reference to `screen'
allegroproject1.cpp:(.text+0x6e1): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x6ea): undefined reference to `screen'
allegroproject1.cpp:(.text+0x718): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x721): undefined reference to `screen'
allegroproject1.cpp:(.text+0x755): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x75c): undefined reference to `screen'
allegroproject1.cpp:(.text+0x79e): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x7a7): undefined reference to `screen'
allegroproject1.cpp:(.text+0x7db): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x7e4): undefined reference to `screen'
allegroproject1.cpp:(.text+0x818): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x821): undefined reference to `screen'
allegroproject1.cpp:(.text+0x84f): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x858): undefined reference to `screen'
allegroproject1.cpp:(.text+0x886): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x88f): undefined reference to `screen'
allegroproject1.cpp:(.text+0x8c3): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x8cc): undefined reference to `screen'
allegroproject1.cpp:(.text+0x900): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x909): undefined reference to `screen'
allegroproject1.cpp:(.text+0x93d): undefined reference to `makecol'
allegroproject1.cpp:(.text+0x946): undefined reference to `screen'
allegroproject1.cpp:(.text+0x95f): undefined reference to `readkey'
collect2: ld returned 1 exit status


The following command however works flawlessly :
g++ allegroproject1.cpp -o allegroproject1 `allegro-config --libs --static`
Just as this one did(in the console) :
g++ allegroproject1.cpp -o allegroproject1 $(allegro-config --libs --static)


I would appreciate if any of you could help me solve this issue till monday

MortenMacFly:

--- Quote from: hyrob on October 01, 2010, 12:38:43 am ---I would appreciate if any of you could help me solve this issue till monday

--- End quote ---
In the project setting, select to append the compiler / linker options. They seems to be in a wrong place anyways - did you put them to the global compiler options?

Navigation

[0] Message Index

[#] Next page

Go to full version