This is the lines used to compile a c++ programme.

  g++ xp_example2.cpp api/gdxco.cpp ../C/api/gdxcc.c api/optco.cpp ../C/api/optcc.c api/gamsxco.cpp ../C/api/gamsxcc.c -Iapi -I../C/api

However, when I use IDE Xcode, I don't know what to change so that I arrive at the exact same thing. For example, How shall I edit my Xcode to incorporated the things like "-I" ? Thank you.

The -I options are for "include directories". There should be a setting in Xcode to allow you to specify a list of include directories, in which you would enter api and ../C/api (or as absolute paths). For the cpp files, you just add them to your project.

N.B.: I don't use Xcode or Mac, so I'm just giving general advice here, as most IDEs have the same kinds of menus and configuration options, so, it should be valid for Xcode too.

Otherwise, you can also use command line tools in Xcode, you just have to install them.

Member Avatar for iamthwee

I use a mac sometimes but I just use g++ for macs. Stay away from xcode it is unecessary unless you're building apps.

Why? Xcode is a huge download and involves registering a mac account blah blah.

https://github.com/kennethreitz/osx-gcc-installer

That is only 4.7mb I think and works very much the same way you would use c++ in a linux environment. Well that's what I use if I need to break out c++ on my mac which is rare nowadays given the work I do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.