News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Compilator option (red please)

Started by guillaumec, August 03, 2016, 04:02:25 PM

Previous topic - Next topic

guillaumec

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.

MortenMacFly

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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

guillaumec

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.

stahta01

#3
I would try this.

In the "Compiler Settings" "Other compiler options" add

`mysql_config --cflags`


And, in "Linker Settings" "Other linker options" add

`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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

guillaumec

Hi,
sorry for the late answer, I wasn't at home past week.
Thanks for help, it's work !!!