• 0

C++ Compiler of choice


Question

Hey all, lately I've been wanting to learn a programming language and decided I'd like to learn C++, I've had suggestions about using Dev-C++ but I've also heard some pretty dodgy reviews due to it not being updated since 2005 and doesn't compile exes properly in some cases. I have Visual C++ 6 already installed and was wondering if this would be a better option. Also please state any better choices and why you think they're better; any tips to get started would also be apprectiated.

Thank you

-Alex

Link to comment
https://www.neowin.net/forum/topic/992110-c-compiler-of-choice/
Share on other sites

Recommended Posts

  • 0

K&R (Second Edition) is ANSI C (c89). If you don't know that, then there is no hope for you. Do do know that K&R created the C language right?

I know who implemented the FIRST version of the C-language. You on the other hand seem to have no idea about C! K&R was NEVER an official standard! The standard was defined years later by the ISO (and ANSI) and is INCOMPATIBLE with the mess you call K&R. If you find any compiler that accepts stuff like

Func(i)
int i
{
...
}

You are using anything but the standard language!

If you want a definitive language reference, then Stroustrup, the creator of the C++ language, is most likely the best source. If you have a real criticism of my book suggestion, then i'd like to hear it.

1. Not your book

2. It's definatly not aimed at anyone who wants to learn the language!

MSVC is renowned for it's poor standards compliance:

http://stackoverflow.com/questions/1599960/visual-c-standards-compliance

A year old and no longer true?

GCC implements the C++ standard, just like every other compiler. However, there are degrees of compliance, and MSVC has a horrible history. Do you really want to write code in MSVC that compiles yet behaves differently or fails to compile with other compilers? Risky business writing code in MSVC if you want any kind of portability and deterministic behaviour.

LOL!!

There's only two things to say:

1. You have no idea about the standard

2. You spread FUD about MSVC

Superceded? Have you heard of ANSI C, aka C89, or standard C! Most C code is written in C89, not C99, and K&R Second Edition, is based on ANSI C. Have you ever even written any C code? If you had, you would have known this.

Again: K&R was never a standard. The ANSI and ISO didn't give a f*** about compatiblity with the mess Keith and Richards designed. Instead the designed a language that actually works without quirks. So yeah, even ANSI-C is incompatible with K&R?

Evidence? Thought not. Spurious claims once again. But I digress, we're getting off topic and clogging this thread up.

You may prove instead where MSVC is any worse than GCC?

  • Like 2
  • 0

At least MSVC makes some efforts to make its error messages meaningful, and understanding your errors is very important when learning a language.

#include <string>
#include <map>

using namespace std;

int main() {
    map<string, string> a(3);
}

MSVC 10:

main.cpp
1>(...)\main.cpp(7): error C2664: 'std::map<_Kty,_Ty>::map(const std::map<_Kty,_Ty> &)' : cannot convert parameter 1 from 'int' to 'const std::map<_Kty,_Ty> &'
1>          with
1>          [
1>              _Kty=std::string,
1>              _Ty=std::string
1>          ]
1>          Reason: cannot convert from 'int' to 'const std::map<_Kty,_Ty>'
1>          with
1>          [
1>              _Kty=std::string,
1>              _Ty=std::string
1>          ]
1>          No constructor could take the source type, or constructor overload resolution was ambiguous
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

GCC 4.4.1:

(...)\Main.cpp: In function 'int main()':
(...)\Main.cpp:7: error: no matching function for call to 'std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::map(int)'
d:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_map.h:170: note: candidates are: std::map<_Key, _Tp, _Compare, _Alloc>::map(const std::map<_Key, _Tp, _Compare, _Alloc>&) [with _Key = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Tp = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Compare = std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, _Alloc = std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >]
d:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_map.h:159: note:                 std::map<_Key, _Tp, _Compare, _Alloc>::map(const _Compare&, const _Alloc&) [with _Key = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Tp = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Compare = std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, _Alloc = std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >]
d:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_map.h:150: note:                 std::map<_Key, _Tp, _Compare, _Alloc>::map() [with _Key = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Tp = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Compare = std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, _Alloc = std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >]
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings

  • 0

Superceded? Have you heard of ANSI C, aka C89, or standard C! Most C code is written in C89, not C99, and K&R Second Edition, is based on ANSI C. Have you ever even written any C code? If you had, you would have known this.

I thought you were talking about the original K&R C book, which refers to the K&R standard. It has been superceded by ANSI C, as we both know.
MSVC is renowned for it's poor standards compliance
GCC doesn't support "export template" either. And the other issues are just a few minor points. While VC6 is renowned for its poor standards compliance, the same cannot be said of more recent versions. If standards compliance is really that important for you, I suggest you check out Comeau.
  • 0
I love Neowin, I really do. Where else can someone post a simple question about a compiler and get the whole breakdown of ANSI and standards compliance in 2 pages? ROFL

Poor guy, now we're going to make him go write Pascal or Fortran. I hope you're happy :p

Shhhhhh, you'll start an argument about Delphi XE vs FreePascal/Lazarus. I wouldn't mention Prism or Fortran.NET either :D

  • 0

GCC doesn't support "export template" either. And the other issues are just a few minor points. While VC6 is renowned for its poor standards compliance, the same cannot be said of more recent versions. If standards compliance is really that important for you, I suggest you check out Comeau.

It goes a bit beyond that. Case in point:

When I first started out with C, I was doing most of my work in Visual Studio, but was required to have it compile and run on a Linux box. Everything was working fine on MSVC, but I would get a lovely seg fault after running it through GCC. After running it through valgrind, it turned out that I had a one off error in one of my strcopys, which was copying into a malloced array large enough for the string, but not the added null delimiter.

MSVC compiled and ran like nothing was wrong. GCC was strict about that sort of thing and compiled and through a seg fault.

Anyway, as far as C++ compilers, it doesn't make much difference in most cases. GCC and MSVC will both do a fine job. If you just need a compiler and not an IDE, I would go with GCC; MSVC requires a lot of flags that you generally don't notice in the IDE.

  • 0

We're not trying to push any licensing ideology here, just helping someone learn and experiment with the C++ language. Since he's using Windows, what will do the best job is Visual Studio.

I just thought I should let you know I'm not restricted to windows, I'm dual-booting windows and Ubuntu on my laptop.

  • 0

This has to be said, I have code::blocks, and I write the 'Hello World!' code and it all worked out fine.

I tried the same code in gedit and saved it as helloworld.cpp

the code I used:

#include <iostream>
using namespace std;

int main () 
{
cout << "Hello! What is your name?";
return 0;
}

in Code::Blocks, worked fine, where as when I tried to execute it in Linux Mint with the command ./helloworld.cpp I got the result:

 Linuxmint bin # ./hello world.cpp
./helloworld.cpp: line 2: using: command not found
./helloworld.cpp: line 4: syntax error near unexpected token '('
./helloworld.cpp: line 4: 'int main ()'
linuxmint bin#

  • 0

Codeblocks worked because it performs the compilation for you.

You're attempting to execute the cpp file, rather than running the executable that the code is compiled into.

If you have g++ you should be able to do

g++ helloworld.cpp -o helloworld

followed by

 ./helloworld

to run it.

  • 0

Well the C++ language is the same no matter the IDE. Correct? just download a different IDE, you'll seem amazing to your tutor with all your stuff working :p

No necessarily different compilers that come with different IDEs will implement different specs of the C++ language.

They could implement up to C++98, 03 or 11, or portions of those.

Then it all gets very confusing when you realise that 11 being brand new is barely implemented (this is the case in MSVC. GCC on the other hand has a good portion of it done).

It gets even worse when you consider implementations of C. For instance MSVC didn't have stdint.h / cstdint until 2010 and there are no plans to provide some C99 features

  • 0

I'm sorry, but I have to call BS on that statement. Microsoft compilers are no more optimised than any others that run on Windows. The difference compared to GCC is that GCC is standards compliant and MSVC is not, just the same way as IE is less standards compliant then other web browsers. MSVC is also proprietary, closed source, and locked down to Windows only.

I'm sorry, but I have to refer to that statement as illogical. Microsoft is quite standards compliant, no less than any GNU/Linux alternative that you can find. IE 9 and the preview version of 10 are EXTREMELY standards compliant, so I am also finding your statement to be even more on the irrational spectrum.

As for IE being less standards compliant, IE supports CSS standardizations such as the

border-radius

as opposed to other so-called "open source" browsers like Mozilla Firefox and Google Chrome, which took much longer to support the

border-radius

property, and instead used a proprietary prefix in front of it, such as

moz-

or

webkit-

. This same dilemma also happened with

box-shadow

and

opacity

. Finally, at least now all or nearly all browsers support the property in its native format. However, for a while, they did not, when IE9 was one of the first browser to do so.

Oh, and should Microsoft be ashamed that they only make Visual Studio for Windows? Should Apple be ashamed that they only make Xcode available for Mac? No. Its their product, and each group as every right to enable it to work on their respective platforms. Just because they don't want to make their products for the less-than-one-percent of Linux users on the Earth does not mean that their products are lacking in quality. If anything, most GNU/Linux/FOSS software is severely lacking in quality. Trust me, I've used a great deal of software, and anything beats using GNU/Linux/FOSS crapware.

The fact is, you are just being anti-Microsoft here, and simply assuming that Visual Studio and any other Microsoft product is terrible simply because it is not open-source. If Visual Studio was open-source, you would be praising it constantly, and you know that is true. Your opinion is backwards to reality, and reflects your ignorance.

  • 0

so now I need to choose which language within C++ I want to learn lol

At the base level, C++ is C++, regardless of platform. For the most basic programs, what you write for one compiler will compile fine with the other. Don't worry about these kinds of things until you get to more advanced stuff, just make sure you get an up to date compiler/IDE combo, and you'll be fine.

I'm sorry, but I have to refer to that statement as illogical. Microsoft is quite standards compliant, no less than any GNU/Linux alternative that you can find. IE 9 and the preview version of 10 are EXTREMELY standards compliant, so I am also finding your statement to be even more on the irrational spectrum.

As for IE being less standards compliant, IE supports CSS standardizations such as the

border-radius

as opposed to other so-called "open source" browsers like Mozilla Firefox and Google Chrome, which took much longer to support the

border-radius

property, and instead used a proprietary prefix in front of it, such as

moz-

or

webkit-

. This same dilemma also happened with

box-shadow

and

opacity

. Finally, at least now all or nearly all browsers support the property in its native format. However, for a while, they did not, when IE9 was one of the first browser to do so.

As for IE being less standards compliant, IE supports CSS standardizations such as the

border-radius

as opposed to other so-called "open source" browsers like Mozilla Firefox and Google Chrome, which took much longer to support the

border-radius

property, and instead used a proprietary prefix in front of it, such as

moz-

or

webkit-

. This same dilemma also happened with

box-shadow

and

opacity

. Finally, at least now all or nearly all browsers support the property in its native format. However, for a while, they did not, when IE9 was one of the first browser to do so.

Oh, and should Microsoft be ashamed that they only make Visual Studio for Windows? Should Apple be ashamed that they only make Xcode available for Mac? No. Its their product, and each group as every right to enable it to work on their respective platforms. Just because they don't want to make their products for the less-than-one-percent of Linux users on the Earth does not mean that their products are lacking in quality. If anything, most GNU/Linux/FOSS software is severely lacking in quality. Trust me, I've used a great deal of software, and anything beats using GNU/Linux/FOSS crapware.

The fact is, you are just being anti-Microsoft here, and simply assuming that Visual Studio and any other Microsoft product is terrible simply because it is not open-source. If Visual Studio was open-source, you would be praising it constantly, and you know that is true. Your opinion is backwards to reality, and reflects your ignorance.

Historically, Microsoft have been very choosy about what standards they implement, and the extent to which those standards get implemented. No-one can argue that 10 years ago Microsoft's support for standards was crap across the board, and their standards support in the web arena was poor until as recently as IE8, which was 2 years ago. Given these facts, I think it's quite forgiveable for people to be weary of using the words Microsoft and Standards Compliance in the same sentence. Things are good these days, but as the saying goes: "fool me once...".

Your example with regards to the CSS border-radius property is completely wrong by the way. Vendor prefixes are encouraged while implementing incomplete CSS standards. -moz-border-radius and -webkit-border-radius exist(ed) because the CSS3 standard had not at the time fully defined how a border corner radius should be declared, therefore vendor prefixes were used to remind developers "This is a vendor specific property, the final implementation of this CSS property may not be of this format". By the time Microsoft finally got around to implementing border-radius, the definition was all but finalized, and the vendor predix was not required. IE9 was also not "one of the first" to support border-radius and box-shadow without a prefix, as it has been supported since the initial Firefox 4 betas in October last year, and in Chrome versions from at least January 2010.

  • 0

so now I need to choose which language within C++ I want to learn lol

As far as specs go, you don't need to worry, as Majesticmerc pointed out. The latest versions of GCC and MSVC support C++03, and partially C++11. No need to bother with C++11 features at the point you're at, and in any case it's relatively unimportant changes.

However in a deeper sense there are several languages in the C++ language, as you can learn by reading Meyer's Effective C++:

  • C
  • Object-Oriented C++
  • Template C++
  • STL

  • 0

I've downloaded Bjarne's C++ third edition ebook yesterday, which I'm going to start studying tomorrow and learn from, 967 pages, should be a good read :p

And the C++89, 03, 11, 99 etc means nothing to me atm lol just random numbers :p

I've downloaded Bjarne's C++ third edition ebook yesterday, which I'm going to start studying tomorrow and learn from, 967 pages, should be a good read :p

And the C++89, 03, 11, 99 etc means nothing to me atm lol just random numbers :p

  • 0

I've downloaded Bjarne's C++ third edition ebook yesterday, which I'm going to start studying tomorrow and learn from, 967 pages, should be a good read :p

And the C++89, 03, 11, 99 etc means nothing to me atm lol just random numbers :p

Stroustrup's book is good reference material but not a good tutorial. I'd recommend something like Stephen Prata's C++ Primer.

The numbers in question are years. So C++03 is the 2003 revision of the specification. I didn't even know different specifications existed for quite a long time actually :p

  • 0

oh wow, so C++ has been around since 89, quite daunting that the language is older than me lol

C++ is a rather complicated beast for a beginning programmer. You have to learn C, C++ OO extensions, the STL etc. It's not all bad, but it will take far longer to master than plain C.

Wikipedia provides a few interesting quotes:

- Richard Stallman criticizes C++ for having ambiguous grammar and "gratuitous, trivial, incompatibilities with C (...) that are of no great benefit".

- Linus Torvalds has said, "C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it".[35]

C is far simpler and only has two standards, c89 and c99, of which c89 is the most prevalent. You can then ignore the ugly STL syntax until later. I would suggest starting with C first. It will make learning C++ easier down the road.

In all honesty, If I want to do some OO development these days, I'd much rather use a modern language such as Python or Java.

  • 0

I would suggest starting with C first. It will make learning C++ easier down the road.

No, it won't make learning C++ easier since they are practically the same language except for the STL, OO, and a few other bits. Learning C, then going to C++ is pointless especially since you will have gotten used to the C way of doing things and then have to remember to switch to the C++ way of doing things (like using new instead of malloc, cout instead of printf, etc).

  • 0

Your example with regards to the CSS border-radius property is completely wrong by the way. Vendor prefixes are encouraged while implementing incomplete CSS standards. -moz-border-radius and -webkit-border-radius exist(ed) because the CSS3 standard had not at the time fully defined how a border corner radius should be declared, therefore vendor prefixes were used to remind developers "This is a vendor specific property, the final implementation of this CSS property may not be of this format". By the time Microsoft finally got around to implementing border-radius, the definition was all but finalized, and the vendor predix was not required. IE9 was also not "one of the first" to support border-radius and box-shadow without a prefix, as it has been supported since the initial Firefox 4 betas in October last year, and in Chrome versions from at least January 2010.

Yes, that is correct. Vender prefixes are encouraged during periods of incomplete CSS standards. However, my post is correct because IE9 was technically the first browser to implement a non-proprietary standard of rendering such things as border-radius and box-shadow. I should have been more specific, however, and referred to the very first IE9 builds, way back to May/June of 2010. I remember the IE9 Platform Previews and Betas having the first non-proprietary support for some CSS standards, as I had the original builds for testing on my computer...

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • I think I understood the article fine. Online password managers open users up to more possibilities of getting hacked, and due to KeePass being offline and local it reduces the idea of getting hacked. If someone chooses to put their database online they're kinda missing the point. With regards to the idea of the on-prem idea, I would have two issues. I'm not sure about the first issue, but I wouldn't be surprised about them offering a cloud storage for the passwords that most wouldn't bother to switch off, regardless of if they went for on-prem or not. The second issue is that the on-prem solution for Bitwarden costs money, whereas KeePass is free and open-source (as far as I am aware). The article points out how to sync the database between devices, and I recognise that deficiency in security. But it isn't a necessity. So both services can offer a same idea, but one is free and the other isn't...choices, choices.... But to each their own.
    • AB Download Manager 1.9.2 by Razvan Serea AB Download Manager is an open-source, feature-rich download manager designed to accelerate downloads, organize files efficiently, and provide seamless control over downloads. With support for multiple connections, resume capability, and an intuitive interface, it enhances the downloading experience for users seeking speed and reliability. The software integrates with various browsers, enabling quick link grabbing and batch downloading. It supports HTTP, HTTPS, and FTP protocols, ensuring broad compatibility with different file sources. Users can schedule downloads, set speed limits, and categorize files automatically for better organization. AB Download Manager is lightweight yet powerful, making it a great alternative to proprietary download managers. Its open-source nature allows developers to contribute, customize, and improve the software as needed. Whether you're downloading large files, managing multiple downloads at once, or seeking an ad-free experience, this tool offers a practical and efficient solution. Key features of AB Download Manager: Multi-Connection Support – Accelerates downloads by splitting files into multiple segments. Resume Capability – Allows paused or interrupted downloads to be resumed without starting over. Batch Downloading – Supports downloading multiple files at once for improved efficiency. Browser Integration – Captures download links directly from browsers for seamless operation. HTTP, HTTPS, and FTP Support – Ensures compatibility with a wide range of file sources. Download Scheduling – Enables users to automate downloads at specific times. Speed Limiting – Lets users control bandwidth usage for optimized performance. File Categorization – Automatically organizes downloaded files into designated folders. User-Friendly Interface – Simple and intuitive design for easy navigation. Cross-Platform Compatibility – Works on multiple operating systems. Ad-Free Experience – No intrusive ads or tracking for a clean user experience. AB Download Manager 1.9.2 changelog: Added New Twilight theme (#1292) Optional download completion notifications on Android (#1290) Fixed Fixed a crash on some older CPUs on Windows Fixed oversized system tray icon on macOS Improved Updated translations Prevented Android devices from sleeping while downloads are active (#1291) Various UI and UX improvements Download: AB Download Manager 1.9.2 | Portable | ~80.0 MB (Open Source) Download: ARM64 | Portable ARM64 | Android Links: AB Download Manager Website | Github Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • I am not surprised because life is the product of a lot of biochemical and physical processes that releases various energies as a by-product. The only thing new here is the detection of these photon emissions. The researches noted this "glow" is not a metaphysical one. They don't even immediately end when one is dead. Things like fires, light bulbs, and on a bigger scale stars release a lot more "light" and they are hardly alive.
    • Did you not understand the concern of the article and/or what on-prem means?
    • If there rumours are true zen 7 will be am5 too
  • Recent Achievements

    • Conversation Starter
      sumytbe earned a badge
      Conversation Starter
    • One Year In
      B4dM1k3 earned a badge
      One Year In
    • One Year In
      DarkWun earned a badge
      One Year In
    • Dedicated
      Almohandis earned a badge
      Dedicated
    • Dedicated
      JuvenileDelinquent earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      516
    2. 2
      +Edouard
      186
    3. 3
      PsYcHoKiLLa
      87
    4. 4
      Michael Scrip
      79
    5. 5
      Steven P.
      73
  • Tell a friend

    Love Neowin? Tell a friend!