Author Topic: Compilator option (red please)  (Read 2143 times)

Offline guillaumec

  • Single posting newcomer
  • *
  • Posts: 8
Compilator option (red please)
« on: August 03, 2016, 04:02:25 pm »
Hi,
I'm creating a software using Mysql.
I wrote the source, that's ok.
When I compile it, with gcc on console, like :"gcc -o NomExecutable $(mysql_config --cflags) main.c $(mysql_config --libs)" it works.
But if I try to compile directly in CodeBlocks, I've many errors...
So, I wish to know where, and how, in codeBlocks, declare the "$(mysql_config --cflags)" and $(mysql_config --libs)" to have a good compilation.
Because, I think if I change my ideas, thoses options will change, so if I know for them, for others I'll do to...
Thanks for help !
Guillaume C.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9615
Re: Compilator option (red please)
« Reply #1 on: August 05, 2016, 05:08:15 pm »
You have to quote that in the build options so that the command is actually run. You are trying to use it as a variable whcih will not work.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline guillaumec

  • Single posting newcomer
  • *
  • Posts: 8
Re: Compilator option (red please)
« Reply #2 on: August 05, 2016, 06:03:21 pm »
Hi,
I've quoted them, but i've always :"--cflags" no such file or directory.
So i'm asking where to put those both informations.
In Compiler settings, linker settings ??
Sorry, I'm a beginner with Code::blocks, and I'm coming from Windows, that is so different for compling (using C++ Builder).
Thanks for help.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7178
    • My Best Post
Re: Compilator option (red please)
« Reply #3 on: August 05, 2016, 10:47:31 pm »
I would try this.

In the "Compiler Settings" "Other compiler options" add
Code
`mysql_config --cflags`

And, in "Linker Settings" "Other linker options" add
Code
`mysql_config --libs`

NOTE: Use of the slanted single quote!

Edit: I normally save the project and reopened it when doing these types of changes.
Some members of the C::B Dev Team says this is NOT needed; but, I seem to need it.

Tim S.
« Last Edit: August 05, 2016, 10:49:23 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline guillaumec

  • Single posting newcomer
  • *
  • Posts: 8
Re: Compilator option (red please)
« Reply #4 on: August 14, 2016, 01:14:26 pm »
Hi,
sorry for the late answer, I wasn't at home past week.
Thanks for help, it's work !!!