Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7908209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:49:45+00:00 2026-06-03T11:49:45+00:00

I feel embarrassed asking this question, but I’ve spent the last half an hour

  • 0

I feel embarrassed asking this question, but I’ve spent the last half an hour trying to figure out how to run a specific source file in eclipse with no luck.

I created a c++ project, then created a source folder and a c++ source file. That file works fine but when I added a second file into the folder it does not seem to run. I know this because ‘hello world’ is being outputted which was in the first source file. The strange thing is if I have an error in my second file then I get errors but after I correct them I still only get the output of the first file.

Is it possible to run the source file thats currently open in eclipse(kind of like how it does with Java)? My goal is to create a new source file for every exercise of a c++ book I work though and have them run independently of each other without having to create new projects for each exercise.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:49:46+00:00Added an answer on June 3, 2026 at 11:49 am

    I just finished creating an online C++ course for lynda.com (info here: http://cpp.bw.org/) using Eclipse, because it’s cross-platform and people can follow along with the exercises on many different platforms. Here’s how I solved this problem:

    First understand how Eclipse CDT works — all the files in a project get compiled and linked together. This means you can only have one main() in your entire project. So putting a bunch of exercise files in one project will not work. Here’s an easy solution:

    Create a new project and select General -> Project for the type of project. Inside of that generic project, link to your directory with all the exercise files in it. (Right-click on the project, select New->Folder, press Advanced in the dialog box, select “Link to alternate location”.) If the directory has sub-directories that’s fine — it works great. This will serve as an easily accessible repository for you, and it will not get compiled.

    Now create another project and select C++ Project for the type of project (I call this one “Working”). Now for each of the lessons copy the file (or files) you’ll be working with from the general project into the Working project. Do your exercises, play with the files, etc. You still have the original files because you’re working on copies, so feel free to make lots of mistakes.

    When you’re done with each exercise just delete the file(s) from Working and run Clean from the Project menu (this step is especially important on Windows using MingW) before copying the next set of exercise files into Working.

    I found this workflow to work really well for this purpose.

    //Bill

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a seasoned programmer and therefore feel a little embarrassed asking this question but
Feel silly asking this question, since this should be easy, but I can't figure
This is a dumb question and I feel embarrassed to ask it, but I'm
I feel a bit embarrassed for asking this but here goes: I'm using Excel
I feel a little stupid asking this question, but I hope that this might
I feel embarrassed asking this, but it seems like something I need to understand:
I feel a bit embarrassed asking this questions, but how the heck can I
I feel silly for asking, but how do I get plan value in this
I feel like such a noob asking this but, for some reason a horizontal
I feel embarrassed to ask this question as I feel like I should already

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.