Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

devc++ problem?

Hello all I have just started to learn c and all is going pretty good, but when I compile using devc++ (set up for c) I get 5 files as an output, source file ok, app file ok, rsrc file what?, rsrc.o file what?, and .o file what? I have deleted all these files just to see what happens and all is ok. I just want to know why are they there and have I not set devc++ up properely.
Any help would be much appreciated.

Comments

  • DariusDarius Member Posts: 1,666
    : Hello all I have just started to learn c and all is going pretty good, but when I compile using devc++ (set up for c) I get 5 files as an output, source file ok, app file ok, rsrc file what?, rsrc.o file what?, and .o file what? I have deleted all these files just to see what happens and all is ok. I just want to know why are they there and have I not set devc++ up properely.
    : Any help would be much appreciated.
    :
    :

    I don't use DevC++ (so I'm not 100% sure about rsrc and rsrc.o), but I imagine rsrc corresponds to program resources (likely just a Version resource for a very simple program), rsrc.o is the object form of the resources, and the .o is the object file that contains your, unlinked, code. If you want to go into Windows programming then you may want to learn about the rsrc files, however chances are you'll probably never directly need to modify them. The .o file on the other hand is very useful and important and generally applicable. However, it's (typically) only useful for larger multi-part programs. None of these files have anything to do with executing the final app (neither does your source file) they are only needed for intermediate parts. Nevertheless you shouldn't delete them as it may cause recompilation of code that doesn't need to be recompiled (this isn't a problem, just a waste of time). Typically when you don't know what something is deleting it is not the best idea.

    If you want to know all the why's and wherefore's of object files then just reply with something to that effect and I or someone else (or both) will expound.

    "We can't do nothing and think someone else will make it right."
    -Kyoto Now, Bad Religion

  • expaddyexpaddy Member Posts: 4
    : : Hello all I have just started to learn c and all is going pretty good, but when I compile using devc++ (set up for c) I get 5 files as an output, source file ok, app file ok, rsrc file what?, rsrc.o file what?, and .o file what? I have deleted all these files just to see what happens and all is ok. I just want to know why are they there and have I not set devc++ up properely.
    : : Any help would be much appreciated.
    : :
    : :
    :
    : I don't use DevC++ (so I'm not 100% sure about rsrc and rsrc.o), but I imagine rsrc corresponds to program resources (likely just a Version resource for a very simple program), rsrc.o is the object form of the resources, and the .o is the object file that contains your, unlinked, code. If you want to go into Windows programming then you may want to learn about the rsrc files, however chances are you'll probably never directly need to modify them. The .o file on the other hand is very useful and important and generally applicable. However, it's (typically) only useful for larger multi-part programs. None of these files have anything to do with executing the final app (neither does your source file) they are only needed for intermediate parts. Nevertheless you shouldn't delete them as it may cause recompilation of code that doesn't need to be recompiled (this isn't a problem, just a waste of time). Typically when you don't know what something is deleting it is not the best idea.
    :
    : If you want to know all the why's and wherefore's of object files then just reply with something to that effect and I or someone else (or both) will expound.
    :
    : "We can't do nothing and think someone else will make it right."
    : -Kyoto Now, Bad Religion
    :
    :
    Thanks for the reply Darius and yes although I am just starting out any information you can give me relating to the said files would be helpful. By the way I dont make a habit of deleting things I was just experimenting and at my stage in programming it would`nt exactly take long to rewrite my program(know what I mean).
  • DariusDarius Member Posts: 1,666
    : Thanks for the reply Darius and yes although I am just starting out any information you can give me relating to the said files would be helpful. By the way I dont make a habit of deleting things I was just experimenting and at my stage in programming it would`nt exactly take long to rewrite my program(know what I mean).
    :

    Okay. Then if rsrc is what I think it is, then it should be a plain text file holding Windows resources. Open it up in a text editor and you should get a general idea of how it works. You'll have to check the documentation you should have for the format as I really don't want to write everything out here, and like I said, you rarely need (or want) to modify these by hand. rsrc.o is just rsrc compiled with a resource compiler, I believe windres may be the program that does it using GNU tools. I don't use GCC for Windows GUI developement. You can also likely compile it through the gcc program.

    So now you have two "object" files. Making a program is broken into two parts by most compiled languages. Compiling and linking. Compiling does the vast majority of the work and (as you know) it's the part that reads in what you type and generates the machine code to do it, however, the output of compilation is not an executable, instead you get an object file. A linker takes an object file as input and generates the executable. So, why bother with this round about way o fdoing things? Mainly so that you can put multiple pieces together at the same or different times. Scenario) You break your program into two source files, when you compile them you want one executable, not two. If the compiler produced executables then this would be a problem. So what you do is you link the two object files together. Now you want to change the second source file. Without object files you'd have to recompile both files, if it took a long time to compile those files this could get very frustrating. Now you add need another routine, but you think FORTRAN is the language to use for it. Since object files are language independent you can combine your FORTRAN routine with the other three files, just by linking the object files (okay it might take a slight bit more work, but nothing obscene). Now your friend thinks he's a hot shot programmer and he can figure anything out. You make up some interesting routine that you want him to play with and see if he can figure out how you got it to do whatever it does. You want him to be able to compile the routine in his own programs so he can test it out and try stuff with it, but you don't want to give him the source code because then he could just read it and see how you got the effect. So, you give him the object file containing routine. Now he has the routine, but he doesn't have the source code.

    That was a quick example of various situations where object files are useful, the last one is somewhat contrived because I like open source software and I didn't want to push the "real-world" analagous use of selling object files while keeping the sourcecode hidden. Library files (.a, .lib) are just collections of object files (literally). Library/object files are what hold the machine code, don't fall into the trap that so many beginning C/C++ programmers seem to of thinking that header (.h) hold the functions. Header files are (in a sense) the table of contents to the library files. When you include stdlib.h that signals the compiler to also link in the standard library (not it won't automatically link in libraries you made), it's not that stdlib.h has the functions in it.

    "We can't do nothing and think someone else will make it right."
    -Kyoto Now, Bad Religion

  • Andre YoungAndre Young USAMember Posts: 0

    __ / http://forcoder.org / free video tutorials and ebooks about < Java, R, Go, C#, Visual Basic .NET, Perl, JavaScript, Swift, Assembly, Delphi, Scratch, PL/SQL, PHP, Python, C, C++, Visual Basic, Ruby, Objective-C, MATLAB Clojure, Logo, COBOL, Dart, SAS, Apex, D, Scala, Prolog, ML, ABAP, Ada, Bash, Erlang, Lisp, Transact-SQL, Fortran, Hack, Awk, Rust, Lua, Julia, LabVIEW, FoxPro, Alice, Kotlin, VBScript, Scheme, Crystal, F# /> _

  • Tyson BlairTyson Blair Member Posts: 35

    rsrc, should for windows resources, and rsrc.o is the compiled resource file object file for linking into the program(lib, dll, etc)

Sign In or Register to comment.