Author Topic: Code:Blocks 10.05 + Allegro + Linux  (Read 10769 times)

Offline hyrob

  • Single posting newcomer
  • *
  • Posts: 3
Code:Blocks 10.05 + Allegro + Linux
« on: September 27, 2010, 06:21:01 pm »
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
« Last Edit: September 27, 2010, 06:23:58 pm by hyrob »

Online stahta01

  • Lives here!
  • ****
  • Posts: 7787
    • My Best Post
Re: Code:Blocks 10.05 + Allegro + Linux
« Reply #1 on: September 27, 2010, 08:43:37 pm »
The tick you used in the post is NOT the correct tick mark.

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

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Code:Blocks 10.05 + Allegro + Linux
« Reply #2 on: September 27, 2010, 09:49:24 pm »
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:" .

Offline hyrob

  • Single posting newcomer
  • *
  • Posts: 3
Re: Code:Blocks 10.05 + Allegro + Linux
« Reply #3 on: October 01, 2010, 12:38:43 am »
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


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Code:Blocks 10.05 + Allegro + Linux
« Reply #4 on: October 01, 2010, 05:21:38 am »
I would appreciate if any of you could help me solve this issue till monday
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?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline hyrob

  • Single posting newcomer
  • *
  • Posts: 3
Re: Code:Blocks 10.05 + Allegro + Linux
« Reply #5 on: October 01, 2010, 08:52:29 am »
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?

In Project menu there is no option "append the compiler / linker options"

I tried to place them in:
Settings > Compiler and debugger > Linker settings >Other linker options
Settings > Compiler and debugger > Compiler settings >Other options

And neither worked.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Code:Blocks 10.05 + Allegro + Linux
« Reply #6 on: October 01, 2010, 09:29:49 am »
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?

In Project menu there is no option "append the compiler / linker options"

I tried to place them in:
Settings > Compiler and debugger > Linker settings >Other linker options
Settings > Compiler and debugger > Compiler settings >Other options

And neither worked.

"Project -> Build options"

It's general a bad idea to add special libraries to the global compiler options, because these options are used for every project and file, that is build with this compiler.
This often leads to errors and we have several posts related to global options, once set by the user, that have caused errors later.