Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: guillaumec on August 03, 2016, 04:02:25 pm

Title: Compilator option (red please)
Post by: guillaumec 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.
Title: Re: Compilator option (red please)
Post by: MortenMacFly 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.
Title: Re: Compilator option (red please)
Post by: guillaumec 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.
Title: Re: Compilator option (red please)
Post by: stahta01 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.
Title: Re: Compilator option (red please)
Post by: guillaumec 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 !!!