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 7970735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:28:14+00:00 2026-06-04T07:28:14+00:00

I am new to C++ from a C#.NET and Visual Studio background (and some

  • 0

I am new to C++ from a C#.NET and Visual Studio background (and some Objective-C / XCode).

I want to write cross-platform (Windows, OS X, Linux) application with C++. I started with TextMate on my Mac and Notepad on my Windows, and compile the code using g++ on command line/terminal to build the executables on its platform.

I got confused when I started using IDE (namely VC++, XCode, and Eclipse). I tried all three and created projects before pasting my code in it. If I start editing in one IDE, I do not know how to get the eventual piece of code to compile on different platform.

For example, if I have a class file – foo.cpp. In Eclipse, it would generate foo.cpp (within it a foo.h, foo::foo()) and a separate foo.h header file (within it a FOO_H_ file etc). In Xcode, it generates a folder Foo constains main.cpp and foo.l) – that’s it. Why the difference?

I though C++ code is just C++ code which produce platform specific executables if compiled on that platform. (e.g. compile on Mac, it becomes a Mac executables; if compiled on Windows, it becomes a Windows executables).

It seems, once I started using IDE, my C++ code automatically become unportable, due to all these auto generated files that I have no understanding about. I try reading documentation on XCode, Eclipse, and Visual Studio at the same time, and it confuses me even further. I just want to write C++…

I am also following Stroustrup’s classic text to pick up C++ and in the book, nothing like header or source of .h or _H_ files were mentioned, as of why all these files were generated.

Besides using Notepad/Textmate + G++ compiler, how can I write pure, portable C++ program in an IDE that can be cross-platform, or is it even possible?

  • 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-04T07:28:16+00:00Added an answer on June 4, 2026 at 7:28 am

    The default (=most commonly used) file structure for a c++ class called Foo consists of a header file called foo.h which will contain the class definition of Foo, and a foo.cpp which contains the definition of the methods of Foo.

    Often all the header files are put into a seperate folder called include.

    So the general approach to have the same file/folder structure, which can be used for more than one IDE is:

    • create the folder structure manually (e.g. include, src and make folders inside your project folder MyProject, the project files for IDEs would go into make, .h files into include, and .cpp files into src)
    • create the .h and .cpp files for your classes manually using the explorer/finder/…
    • use “add existing file” or something equivalent to add those files to the project file of your IDE.
    • as Rup pointed out, for Visual Studio, one should use the “empty project” preset, or it will add some header files you dont want
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Visual C++, .NET, and the Windows world of programming (coming from
i am new to asp.net, ı want to get data from url on asp.net.
I am still relatively new at VB.Net and Visual Studio and I'm assuming that
Hi I'm new to Visual Studio.NET.I saw a tutorial but I can't see any
I'm new to C# and using C#.Net 2.0 with Visual Studio 2005. How can
I'm creating my first program in Visual Studio C++ 2008, coming from VB.NET -
I am using a web service that requires authentication from .NET (Visual Studio 2010).
When creating a new ASP.NET application in Visual Studio, a couple of files and
I am new to visual studio/asp.net so please bear with me. Using vs 2005
I'm new to ASP.net, how can I read parameters passed from ASP.net page (

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.