CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2008
    Posts
    91

    visual C++ use with gcc?

    hi can i use visual c++ studio express edition for my IDE and make it compile using GCC (gcc is free and cross platform) compiler. i want to make my application cross platform. gcc is easy way for me to do this.
    also though i like the visual C++ IDE alot.

  2. #2
    Join Date
    Nov 2006
    Posts
    1,611

    Re: visual C++ use with gcc?

    I, too, focus on portable code and use GCC, but not inside Visual Studio.

    I don't know the specifics, but google reveals several threads in various places where Visual Studio is configured to use makefiles and fire off the appropriate commands, but there's a few catches.

    It appears that you can no longer use the debugger within the IDE, and there's no parallel compilation, in some cases the optimizations may not be as good, etc.

    In my own work, I simply use a VM with Linux, and I have a Mac with XCode (which is based on GCC), so I post my code and compare compilations. To me it's easier than imposing GCC on Visual Studio.
    If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).

  3. #3
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: visual C++ use with gcc?

    It's usually better to use Visual Studio's native compiler even if you are writing cross-platform code, because different compilers will warn you about different things.

  4. #4
    Join Date
    Dec 2008
    Posts
    91

    Re: visual C++ use with gcc?

    then is there any way i can make visual C++ warn me about the cross platform errors so i dont have to write 2 versions of the code every time?
    like i dont want to use visual C++ special functions like _itoa instead of itoa (i have to change these back), but visual C++ stupid gives me warning when i use itoa??

  5. #5
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: visual C++ use with gcc?

    Quote Originally Posted by poolisfun
    then is there any way i can make visual C++ warn me about the cross platform errors so i dont have to write 2 versions of the code every time?
    like i dont want to use visual C++ special functions like _itoa instead of itoa (i have to change these back), but visual C++ stupid gives me warning when i use itoa??
    You could disable language extensions and set a high warning level, but that is not foolproof. You really should compile the code with multiple compilers if you want to be more certain that you are not doing things that are implementation/platform specific (e.g., relying on a header that is indirectly included).
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  6. #6
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: visual C++ use with gcc?

    Most of those warnings come with instructions on how to disable them. Worst case, you can always write something in a header file like

    Code:
    #  if defined(MSC_VER)
    #   define itoa(x) _itoa(x)
    #  endif
    It's worth noting, however, that proper C++ constructs are for the most part *not* so deprecated; that is limited mostly to libc. So for instance, you wouldn't get such a warning if you use a stringstream to do the conversion rather than itoa.

  7. #7
    Join Date
    Dec 2008
    Posts
    91

    Re: visual C++ use with gcc?

    ok thanks every1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured