Thread: Very much a beginner C ++

  1. #1
    Registered User
    Join Date
    Aug 2007
    Location
    Idaho
    Posts
    4

    Unhappy Very much a beginner C ++

    Ok everyone i'm trying to teach myself C++ from books, and mostly tutorials and getting as much sample code as possible. Here;s my new problem

    I just received a few Zip Files with many .cpp files and i dont know how to get them all into one to compile into the sample that its supposed to be. I have been going through tutorials on writtting the code, but these are already written but how do i get them in order in one so i can get the finish product so i can see what the code is supposed to be doing?

    I have 10 yrs experience in coding something totally different, but i really like the C code that i hope to get to the highest of expereince with it.

    Any help would be used for by learning benefit and Than you in advance.

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    If you have a project with multiple .cpp files, you can compile them all on the command line. If you're using g++, for example....

    Code:
    g++ file1.cpp file2.cpp file 3.cpp
    etc. etc..

    If you're using an IDE, then you need to RTM with regard to the way to add each file to the project.

  3. #3
    Registered User
    Join Date
    Aug 2007
    Location
    Idaho
    Posts
    4
    The complier i downloaded is Bloodshed, the files that were sent to me are named not numbered also. This is my homework assigned by myself, i will teach myself and avoid the school thing.

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    It doesn't matter what order you specify them. I just used that as an example.

    Just add each file you need to a project. I believe the IDE you're using is called Dev C++ (which uses the MinGW compiler under the hood), but I personally don't use that IDE, so I can't tell you how to go about compiling your project. Perhaps someone else that uses Dev C++ would care to elaborate.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I have no idea how bloodsheed works other than what I can read on the website for it.

    But in general, all IDE's work around a format of a "project" or "solution", which is a file describing the "product" that you are building, be that a single .exe file, or dozens of more or less complicated parts (.exe, .sys, .dll files for example) that combine into a large software package.

    The IDE has some way of saying "new project", and then "add file to project". Add your .cpp files to the project - you may want/need to add any related .h files too, but make sure these are "not compiled" - most IDE versions knows to not compile header-files, so it's usually not a problem.

    Once you have all the components in your project, your usual method of building should work just fine.

    --
    Mats

  6. #6
    Registered User
    Join Date
    Aug 2007
    Location
    Idaho
    Posts
    4
    Is this not a good program complier, i just searched for one when i decided to learn the C Code

  7. #7
    Registered User
    Join Date
    Aug 2007
    Location
    Idaho
    Posts
    4
    Thanks that helped me make the first of many to come hurdles

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I use three different development models:
    1. Makefile, gcc and emacs.
    This is what I use for Linux development all the time.
    2. Microsoft Visual Studio (C++).
    I use MS Visual Studio to do Windows programs, because it's really slick for that. I've also used it for driver development (because that's what the other 50 or so developers in the company used).
    3. Emacs, small batch-file and Microsoft Visual C++ "cl" compiler.
    I use this combination for "console" applications - I'm better at running Emacs than visual studio, and when you are switching back and forth between the command-line to RUN the app, might just as well compile there.

    As to the quality of bloodshed, I have no idea - if I'm using "gcc", I use emacs to edit anyways.

    gcc/g++ is definitely a worthy contester in the compiler arena. It is also available in open source, which leaves freedom for those developing new environments (gcc probably supports more processor architectures than all other compilers combined).

    But like so many things in life, a lot of the choices for compiler and the environment around that, it is a personal choice. Some people like "vi" as an editor (and I'm by no means trying to start the religious war of "which editor is best" - they all have good things and bad things, I just "grew up" on Emacs and [even before I used any version of Unix, I was using "AMIS", which is a different implementation of a Emacs-like editor, on a computer that when I first used it was in it's tenage years as a processor architecture, PDP-11. I even ported a Tiny-AMIS that was later implemented on said PDP system onto my Atari ST at the time - that was about 20 years ago!].

    I don't think bloodshed is "bad", I just haven't used that product - there are plenty of different IDE applications out there, and one could spend the entire life just figuring out which does what. But they all do roughly the same thing.

    --
    Mats

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Same old beginner question...
    By Sharmz in forum C Programming
    Replies: 15
    Last Post: 08-04-2008, 11:48 AM
  2. What are some good beginner programs I shouold make?
    By oobootsy1 in forum C# Programming
    Replies: 6
    Last Post: 08-09-2005, 02:02 PM
  3. Books, Beginner, MustHave
    By Zeusbwr in forum C++ Programming
    Replies: 9
    Last Post: 10-25-2004, 05:14 PM
  4. Windows programming for beginner (Absolute beginner)
    By WDT in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2004, 11:21 AM