[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: header check, cross compiling and compiler version?
From: |
Peter O'Gorman |
Subject: |
Re: header check, cross compiling and compiler version? |
Date: |
Sat, 22 Mar 2008 00:33:58 -0500 |
User-agent: |
Thunderbird 2.0.0.9 (X11/20071115) |
aaragon wrote:
> Hi everyone,
>
> I used to write c++ code in Ubuntu Linux, and then I started working on Mac
> OS so I had to transfer all my c++ code to the new system. My first task was
> to get a newer compiler than the one that is shipped by default with Leopard
> so using macports I compiled GCC v4.3. Now, for my surprise, most of my code
> didn't compile because it seems that the hash_set and hash_map (previously
> found under the ext/ directory) now became unordered_set and unordered_map,
> so I guess they are standard.
I don't really understand the need to install a different compiler, the
gcc-4.x that ships with Xcode-3.0 is good enough for most Mac OS X
developers, and has quite a number of APPLE_LOCAL patches that you will
not find in upstream fsf gcc.
>
> So, I had not only the header problem, but also the compiler version and the
> OS is different as well. I was using autotools before, but I didn't have all
> these checks. Honestly, I don't know how to solve these problems. I still
> need to compile the code on Linux machines, but then I have to #define a
> variable for the different headers. It would be nice if one could detect
> the system type, and then add directories to the search for headers. I
> couldn't find anything that accomplishes this so I was wondering if it is
> possible. For example, if I am in a Darwin OS, I could add directories
> /opt/local/include (macports) or /sw/include (fink) to the search. Is there
> a way to do this using autoconf?
>
> What is the best approach to take in these cases? Do you define parameters
> in config.h for later use for each OS, compiler version? Please help, I'm
> really lost,
>
Usually setting CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib
at configure time is sufficient. It is also possible to do this with gcc
env vars LIBRARY_PATH and CPATH.
Does this answer your question?
Peter
--
Peter O'Gorman
http://pogma.com