Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Setting up a C programming environment

Programming languages, Coding, Executables, Package Creation, and Scripting.
Message
Author
den4oman
Posts: 13
Joined: 2016-04-07 22:35

Re: Setting up a C programming environment

#16 Post by den4oman »

tomazzi you're talking about this one https://notepad-plus-plus.org/ ,right?
On Windows i used it , so i can open every type of file, so i can't agree with u about encoding.
I have mistake - i used DevCpp , not Notepad++ for compiling and that was a really a long time ago - on middle High School level, so i'm sorry about talking like that about Code::Blocks. I can't give an abstract point of view. It is really good IDE and i recommend it too ... :oops:
What i wanted to say is that the Atom editor is really interesting - you didn't said anything about it.
And that gcc in terminal is what you should do - because it can give you a lot of useful skills. If you want to write in C , you'll probably want a low level of everything ... ( i think )

PS. Again sorry for the comment about Code::Blocks ...
PSS. The year was around 2009 when i last used Code::Blocks/DevCpp/Notepad++

User avatar
ralph.ronnquist
Posts: 342
Joined: 2015-12-19 01:07
Location: Melbourne, Australia
Been thanked: 6 times

Re: Setting up a C programming environment

#17 Post by ralph.ronnquist »

@tomazzi: being right, or not, is not an excuse for being aggressive.

tomazzi
Posts: 730
Joined: 2013-08-02 21:33

Re: Setting up a C programming environment

#18 Post by tomazzi »

ralph.ronnquist wrote:@tomazzi: being right, or not, is not an excuse for being aggressive.
Do You mean this?
Bullshit - You have simply no idea what You're talking about.
But what's worse - most likely You've never even launched the C::B (...)
Well, bullshits is bullshit, no matter how You are going to call it. Your definition of agression is apparently broken.
den4oman wrote:tomazzi you're talking about this one https://notepad-plus-plus.org/ ,right?
On Windows i used it , so i can open every type of file, so i can't agree with u about encoding.
No. Please read with understanding.

-----------------------------------
den4oman wrote:What i wanted to say is that the Atom editor is really interesting - you didn't said anything about it.
I don't know that editor. But it's not an IDE - therefore I'm not really interrested to try another tabbed editor clone, especially that all of them are based on the same solution: scintilla.
den4oman wrote:And that gcc in terminal is what you should do - because it can give you a lot of useful skills. If you want to write in C , you'll probably want a low level of everything ... ( i think )
List that "useful" skills please...

I can start with the first one:
An ability to stop yourself from crashing the monitor off the wall, after You realized that a little mistake requires partial recompilation of the project, and You need to write that long list of gcc and linker options again, without making another mistake ;)
Odi profanum vulgus

den4oman
Posts: 13
Joined: 2016-04-07 22:35

Re: Setting up a C programming environment

#19 Post by den4oman »

@tomazzi
You are the one who need to read carefully, i'm talking about the one with the url i posted.... And i also wrote that it was a really long time ago ...

About the skills:

make mistake -> remember what cause it -> don't make it next time ; )

As i said
If you want to write in C , you'll probably want a low level of everything ... ( i think )
If you think gcc in terminal is useless ... please tell me what C programs you're making ?

tomazzi
Posts: 730
Joined: 2013-08-02 21:33

Re: Setting up a C programming environment

#20 Post by tomazzi »

den4oman wrote:@tomazzi
You are the one who need to read carefully, i'm talking about the one with the url i posted....
I was talking about Notepad, not Notepad++... never mind.
den4oman wrote:If you think gcc in terminal is useless ...
Yes, gcc used in teriminal by manually issuing all the options is next to useless - and definitely It won't teach You anything.

Using of gcc in terminal can be good for a "hello world" or at a very early stage of learning, but otherwise it's just a waste of time, productivity and it'll be source of many, sometimes undetectable, errors (especially the order of linking of the object files)

*ALL* software projects in the world are using scripts which are in turn invoking gcc to compile the code.
The scripts are either generated by autotools or by IDEs or in a mixed way: the IDE can be used to configure autoconf/automake which in turn will create the final script.

This is how it works, no matter if it's EMACS, Code::Blocks, Eclipse or whatewer.

And to show You a sample, here is a set of commands needed to compile a relatively small program (exactly 5515 lines of code).
This is a debug mode, in which most of specialized gcc options is not used (to avoid confusing the debugger):

Code: Select all

gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/devices/mal.c -o target/obj/src/devices/mal.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/devices/mal_cnv.c -o target/obj/src/devices/mal_cnv.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/sdcs_HC/client_db.c -o target/obj/src/sdcs_HC/client_db.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/sdcs_HC/daq_hc.c -o target/obj/src/sdcs_HC/daq_hc.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/sdcs_HC/devcon_hc.c -o target/obj/src/sdcs_HC/devcon_hc.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/sdcs_HC/hc_main.c -o target/obj/src/sdcs_HC/hc_main.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/sdcs_HC/host.c -o target/obj/src/sdcs_HC/host.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/shared/compstr.c -o target/obj/src/shared/compstr.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/shared/connection.c -o target/obj/src/shared/connection.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/shared/dynarr.c -o target/obj/src/shared/dynarr.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/shared/iface.c -o target/obj/src/shared/iface.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/shared/log.c -o target/obj/src/shared/log.o
gcc -Wall -pthread -Wextra -g -DDBG_LEVEL_0_off -DDBG_LEVEL_1 -DDBG_LEVEL_2  -c /home/tomazzi/ProgLinux/SLiMDCS/src/shared/protocol.c -o target/obj/src/shared/protocol.o
g++  -o target/sdcs_hc target/obj/src/devices/mal.o target/obj/src/devices/mal_cnv.o target/obj/src/sdcs_HC/client_db.o target/obj/src/sdcs_HC/daq_hc.o target/obj/src/sdcs_HC/devcon_hc.o target/obj/src/sdcs_HC/hc_main.o target/obj/src/sdcs_HC/host.o target/obj/src/shared/compstr.o target/obj/src/shared/connection.o target/obj/src/shared/dynarr.o target/obj/src/shared/iface.o target/obj/src/shared/log.o target/obj/src/shared/protocol.o  -Wl,--hash-style=gnu -z relro  -lrt -lcxc -ltxtconf
den4oman wrote:... please tell me what C programs you're making ?
The above compiles a threading server, which is part of bigger project, but the code is not released yet. (I'll finish this in a month or two I think)
However, if You wish, You may take a look at the code of the cxc lib, which is one of the key components of the project.

Regards.
Odi profanum vulgus

den4oman
Posts: 13
Joined: 2016-04-07 22:35

Re: Setting up a C programming environment

#21 Post by den4oman »

@tomazzi,

this is just my opinion. Don't want to make anyone do it, just saying.
Scripts ? But how you write them , when you never used gcc in terminal ? ( not talking about you, saw your libraries , keep up the good work man :beer: )
Thats all from me on this topic.

Best Regards

tomazzi
Posts: 730
Joined: 2013-08-02 21:33

Re: Setting up a C programming environment

#22 Post by tomazzi »

den4oman wrote:Scripts ? But how you write them , when you never used gcc in terminal ?
You don't - that's what I've already said, I think.

For autotools, You need to write a configuration file, which is then used to generate necessary makefiles, which in turn are invoked using very well known commands: configure && make ;)

In an IDE You just define all the project properties using GUI, and the software generates required set of gcc commands (just like in the example in my previous post.).

This doesn't mean however, that You don't have to know what particular compiler options are doing. None of the IDEs will set the options for the project - this is responsibility of the author.

Therefore, the programmer must read the documentation for the compiler and the linker.

But:
In any way this doesn't imply that You have to learn and test the options in the terminal.

Any environment can be used for learning how particular option works, and interactive terminal is definitely not the most convenient one.

Regards.
Odi profanum vulgus

Post Reply