compiling iso c++ code in Visual Studio environment

Discussion in 'C++' started by RS, Aug 26, 2006.

  1. RS

    RS Guest

    Hi all,

    My code compiles well with gcc on linux and OS X, but now I have to run
    it at work, and my only choice is Visual Studio .Net 2003 environment on
    windows, which I had never used before. I've noticed several obstacles
    with the compilation. For example this environment insists that we put
    all headers under a stdafx header, which I managed to find a way to get
    around. But there are other issues. For example, Visual Studio claims
    that there is no such thing as std::numeric_limits. Also, it gives a
    bizarre error that there is something wrong with the stdio headers in my
    files-- except that I don't use stdio, I use iostream.

    I don't need all the fancy windows-specific C++ routines, but I need to
    use Visual Studio as a compiler. I was wondering if anyone experienced
    with it can give me a hint or two about compiling portable code with it
    with minimum overhead. For example, is there an option to check to let
    it know we are compiling iso code? Also, are there any online tutorials
    or guides for people who need to migrate from gcc to visual Studio 2003?
    If not, any good books that don't dwell on C++, but just teaches the
    ..Net 2003 environment?

    Thanks,
    RS
     
    RS, Aug 26, 2006
    #1
    1. Advertising

  2. RS

    Ian Collins Guest

    RS wrote:
    > Hi all,
    >
    > My code compiles well with gcc on linux and OS X, but now I have to run
    > it at work, and my only choice is Visual Studio .Net 2003 environment on
    > windows, which I had never used before. I've noticed several obstacles
    > with the compilation. For example this environment insists that we put
    > all headers under a stdafx header, which I managed to find a way to get
    > around. But there are other issues. For example, Visual Studio claims
    > that there is no such thing as std::numeric_limits. Also, it gives a
    > bizarre error that there is something wrong with the stdio headers in my
    > files-- except that I don't use stdio, I use iostream.
    >

    You'd do better by posting to a VS group, this one is for the C++
    language, not specific tools.

    --
    Ian Collins.
     
    Ian Collins, Aug 26, 2006
    #2
    1. Advertising

  3. RS

    Jim Langston Guest

    "RS" <> wrote in message
    news:...
    > Hi all,
    >
    > My code compiles well with gcc on linux and OS X, but now I have to run it
    > at work, and my only choice is Visual Studio .Net 2003 environment on
    > windows, which I had never used before. I've noticed several obstacles
    > with the compilation. For example this environment insists that we put all
    > headers under a stdafx header, which I managed to find a way to get
    > around. But there are other issues. For example, Visual Studio claims that
    > there is no such thing as std::numeric_limits. Also, it gives a bizarre
    > error that there is something wrong with the stdio headers in my files--
    > except that I don't use stdio, I use iostream.
    >
    > I don't need all the fancy windows-specific C++ routines, but I need to
    > use Visual Studio as a compiler. I was wondering if anyone experienced
    > with it can give me a hint or two about compiling portable code with it
    > with minimum overhead. For example, is there an option to check to let it
    > know we are compiling iso code? Also, are there any online tutorials or
    > guides for people who need to migrate from gcc to visual Studio 2003? If
    > not, any good books that don't dwell on C++, but just teaches the .Net
    > 2003 environment?
    >
    > Thanks,
    > RS


    Best asked in microsoft.public.vc.language or such, but...
    Project -> xxx Properties -> Configuration Properties -> C/C++ ->
    Precompiled Headers -> Not Using Precompiled Headers
    Project -> xxx Properties -> Configuratino Properties -> C/C++ ->
    Language -> Disable Language Extentions -> yes
     
    Jim Langston, Aug 26, 2006
    #3
  4. RS

    P.J. Plauger Guest

    "RS" <> wrote in message
    news:...

    > My code compiles well with gcc on linux and OS X, but now I have to run it
    > at work, and my only choice is Visual Studio .Net 2003 environment on
    > windows, which I had never used before. I've noticed several obstacles
    > with the compilation. For example this environment insists that we put all
    > headers under a stdafx header,


    No it doesn't. It just makes it too easy for beginners to make
    that choice.

    > which I managed to find a way to get
    > around.


    Quod erat demonstrandum.

    > But there are other issues. For example, Visual Studio claims that
    > there is no such thing as std::numeric_limits.


    No it doesn't. It's there if you include <limits>, as you should.

    > Also, it gives a
    > bizarre error that there is something wrong with the stdio headers in my
    > files-- except that I don't use stdio, I use iostream.


    Then you should provide a small test program that replicates the
    behavior.

    > I don't need all the fancy windows-specific C++ routines, but I need to
    > use Visual Studio as a compiler. I was wondering if anyone experienced
    > with it can give me a hint or two about compiling portable code with it
    > with minimum overhead. For example, is there an option to check to let it
    > know we are compiling iso code? Also, are there any online tutorials or
    > guides for people who need to migrate from gcc to visual Studio 2003? If
    > not, any good books that don't dwell on C++, but just teaches the .Net
    > 2003 environment?


    You're facing the usual problems when moving from one development
    environment to another. The lapses tolerated by your previous
    compiler now appear as mysterious failures. The usual beginner's
    reaction is to blame the new environment for not "conforming".
    But I assure you that the Microsoft environment is *at least* as
    conforming as the ones you've been using. You just have to launder
    your code a bit to bring it to a higher level of portability.

    P.J. Plauger
    Dinkumware, Ltd.
    http://www.dinkumware.com
     
    P.J. Plauger, Aug 26, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wh
    Replies:
    2
    Views:
    540
    Cowboy \(Gregory A. Beamer\)
    Jan 16, 2004
  2. Thirumalai
    Replies:
    0
    Views:
    693
    Thirumalai
    May 22, 2006
  3. rockdale
    Replies:
    1
    Views:
    626
    Juan T. Llibre
    Aug 23, 2006
  4. xman
    Replies:
    0
    Views:
    527
  5. xman
    Replies:
    1
    Views:
    623
    Victor Bazarov
    Aug 17, 2005
Loading...

Share This Page