User forums > Help

How to edit the command to compile C files within C::B?

(1/1)

alereche:
Hello!

I am running C::B on Ubuntu 14.10, using gcc compiler for C programming purposes only.

The way things as configured, the gcc command generates a file with a ".o" extension. After, it seems to be passed to g++ in order to generate the executable file (without any extension, on Linux).

How can I edit this command on C::B in the following simple manner?

> gcc file.c -o file

Furthermore, once I execute this command on a terminal and generate the executable on the proper folder, C::B reads and runs it!

I think there is no problem in having only gcc and not having g++ compiler. (BTW, it seems impossible to download it on my distribution, for some dependence reasons.) So it will be fantastic just to reconfigure C::B to use only gcc.

Best regards,

Alex

P. S. I passed the day searching for this without any success. Thanks in advance.

Scr3amer:
Yo buddy,

To use gcc instead of g++ for linking part, you can modify that by editing the linker program.

Settings>Toolchain executables tab>linker for dynamics libs , you erase g++ and write gcc.

It will still be a 2 steps compilation though : .c -> .o -> executable.

EDIT :

But you wont be able to compile C++ projects anymore.
If you want to do something cleaner, you can copy the GCC compiler profile, rename it a meaningful way (Exclusive C compiler - GCC for instance) and set your project for using this compiler profile.
Right click on your project > build options and select it ^^.

That way, if one day you do C++ project, you will just have to select the original GCC compiler profile.

alereche:
Beautiful solution!

Long live to Scr3amer!

Alex

Navigation

[0] Message Index

Go to full version