-
Question about C++, compilers
Ok firstly may someone tell me what exactly is MinGW? It's based off GCC which is a compiler?
And Borland would be another compiler?
After having trouble setting up qt, I decided to uninstall it along with code::blocks.
I installed mingw, which i suspect you compile program from your windows CMD? And I should have a 'make' command? Would this be correct?
Because I keep getting 'make' is not recognized as in internal or external command...
Change my enviorment varible PATH? I added C:\MinGW and still get the same error...
Lastly Visual C++ is just C++ written with mircosoft's visual studio? So why do we have a dedicated category for it? It's the same C++ code written with a standard notepad is it not??
Any help getting me on the right track with all this would be really appreciated. :)
-
Re: Question about C++, compilers
MinGW is a minimalist GCC compiler for Windows yes, Borland is another. They adhere to the C++ standard, but also have their own functionality as well.
Writing C++ on Windows is hell, Windows does not have a make command. You can either download a UNIX shell like Cygwin, or you can use cmake, however, cmake is not compatible with regular makefiles.
Visual C++ is standard C++, but it has extra stuff for Windows. There is an separate forum here because most of the questions in there deal with using the Windows API, not necessarily the C++ compiler. I can't speak for everyone, but I think most of us in here use GCC on unix or linux.
-
Re: Question about C++, compilers
Ok I got the mingw thing. So how would you compile programs using mingw and windows?
And by extra stuff you mean extra libraries, functions?
Talking about Unix... It's still available? People still use it? LoL sorry for sounding like a noob... But was'nt UNIX a operating system for 'mainframes' back in the day?
-
Re: Question about C++, compilers
Quote:
Originally Posted by
ninja9578
or you can use cmake, however, cmake is not compatible with regular makefiles.
Well, it is, but you may be misunderstanding CMake. Not that I'm an expert or anything, but after playing around with it, CMake seems to be a tool for generating build files----its output can be Makefiles, VS projects, etc.
Quote:
Originally Posted by
Chris Evil
Ok I got the mingw thing. So how would you compile programs using mingw and windows?
You could use Cygwin, which adds a Unix-like command-line to Windows (distinct from the DOS-like command window that you normally have). I'm not sure if MinGW works outside of Cygwin or not.
Quote:
Originally Posted by
Chris Evil
And by extra stuff you mean extra libraries, functions?
Every compiler has its own little extensions and quirks----things it will support that others don't. A particular function, a particular syntax, etc. I actually think this is a problem, since it encourages non-standard coding.
Quote:
Talking about Unix... It's still available? People still use it? LoL sorry for sounding like a noob... But was'nt UNIX a operating system for 'mainframes' back in the day?
When people refer to Unix, they're usually talking about "unix-like" systems such as Linux or Solaris. There are a lot of specific variations, but they all have underlying commonalities from the Unix core.
-
Re: Question about C++, compilers
Use Code::Blocks, it's nicely integrated with MinGW, you can even install them together.
No, VC++ has extra functions and types and all sorts of stuff. All compilers offer some compiler-specific features. In VC++, you can do this:
Code:
for (unsigned int i = 0; i < 15; ++i){
//something
}
cout << i << endl; //in all other compilers, i is not in scope
This technically means that VC++ shouldn't even be able to call itself C++, as it violates the standard, but I think they made this kind of behavior optional recently.
UNIX is by a wide margin the dominate operating system. People tend to forget that PCs take up a small amount of all of the computing that's done. Almost all phones, calculators, servers, medical devices, guidance systems... have either unix or Linux under the hood. Mac OSX is UNIX, and Linux is based off of UNIX.
-
Re: Question about C++, compilers
Quote:
Originally Posted by
Lindley
When people refer to Unix, they're usually talking about "unix-like" systems such as Linux or Solaris. There are a lot of specific variations, but they all have underlying commonalities from the Unix core.
If I remember correctly, Solaris is BSD UNIX.
-
Re: Question about C++, compilers
Quote:
Originally Posted by
ninja9578
In VC++, you can do this:
Code:
for (unsigned int i = 0; i < 15; ++i){
//something
}
cout << i << endl; //in all other compilers, i is not in scope
I'm fairly certain that bit of weirdness was confined to VS 6.
-
Re: Question about C++, compilers
Quote:
Lastly Visual C++ is just C++ written with mircosoft's visual studio? So why do we have a dedicated category for it? It's the same C++ code written with a standard notepad is it not??
MSVC is by far the most popular compiler for the windows platform, and windows is the most used OS out there.
In other words, a lot of people are using MSVC, and most of them are doing stuff that's specific to windows. It just makes sense to have a separate category for them.
Quote:
This technically means that VC++ shouldn't even be able to call itself C++, as it violates the standard, but I think they made this kind of behavior optional recently.
I'm sure this has been fixed since at least MSVC8 (2005). It definitely doesn't work with MSVC10 (2010), even with language extensions enabled.
-
Re: Question about C++, compilers
Yeah I've been reading about this whole linux/unix/unix-like/gnu, doing my head in but oh well..
MinGW is a port of the GCC for windows (right?), so I still need cygwin? Is that what code::blocks would using or?...
Where do I go to from here? Use code::blocks? But what about the qt/mingw 'make' command error?
Thanks guys..
-
Re: Question about C++, compilers
MinGW and Borland (and Visual Studio) firstly are so-called IDE's (Integrated Developer Environment) what means there is one program (studio) with a source-code editor, a compiler, a project tree, a debugger, multiple wizards for code generation and some more tools where you can edit, build and run new projects. The point of an IDE is that you can do all things necessary for (normal) development from this one application.
While Borland (and VS) have their own C++ compiler, MinGW uses one of the GNU compilers mostly gcc and because those are based on makefiles MinGW is based on makefiles as well but can support you to change those makefiles interactively.
Other IDE's mostly have their own (proprietary) project files which may or may not be similar to makefiles. For example VC compiler was based on a projectfile format similar to a makefile until VC6 (1998) and changed to a XML projectfile for later versions.
qt also has an IDE (afaik it uses gcc compiler) but it also has Add-Ins for other IDE's so that you can use the resource editor and wizards of qt but make the builds using the 'normal' IDE's.
If you had trouble setting up qt, it normally isn't a good idea to try another IDE where the hurdles for a beginner are even higher than with qt. For example in MinGW you hardly can succeed if you don't know how makefiles work and what you have to change in those makefiles when you get a linker error. In qt IDE (same as in VS and Borland) you wouldn't much care for project files yourself but mostly let do the IDE for you (note, that assertment must not be true for all projects). Moreover, with qt, VS and Borland you can develop GUI programs while the MinGW (also CygWin and some other) firstly offer support for console and server applications.
Regards, Alex
-
Re: Question about C++, compilers
Quote:
MinGW is a port of the GCC for windows (right?), so I still need cygwin? Is that what code::blocks would using or?...
Where do I go to from here? Use code::blocks? But what about the qt/mingw 'make' command error?
If you're on Windows and just learning I would recommend using MSVC. The Express version is available for free or if you're eligible for academic purchases you can get the Pro edition free via Dreamspark.
-
Re: Question about C++, compilers
One thing which may be helpful to understand is the nature of a project/makefile: Basically, such a thing is merely a file specifying the arguments to be passed to the compiler and linker in order to build all the source code.
-
Re: Question about C++, compilers
Ok so standalone minGW is for the more advanced user?
Secondly to understand the nature of project files I'll try read up on that thank you :)... Apart from what they are, is there no 'native' make command for windows? So are you not mean/encouraged to compile C++ files with windows?
How should I go about compiling C++ files meant for QT?
-
Re: Question about C++, compilers
Quote:
Originally Posted by
Chris Evil
Ok so standalone minGW is for the more advanced user?
I'd say that MinGW is intended to allow Windows users to more easily build things that were originally written for Unix-like systems.
Quote:
Apart from what they are, is there no 'native' make command for windows? So are you not mean/encouraged to compile C++ files with windows?
I'm not sure what you mean by that. The most commonly used build tool on Windows is Microsoft Visual Studio. Technically this means most people use the Microsoft Compiler, but almost no one invokes it directly on the command line, preferring to go through the IDE.
Quote:
How should I go about compiling C++ files meant for QT?
QT is a library. All you have to do is set up your project or Makefile to properly know where the QT headers and libraries are, and link it in appropriately during the build.
-
Re: Question about C++, compilers
Mingw and Cygwin are not the same when using them. One brings unix tools to windows to build native applications and the other brings the unix environment to windows so your unix apps can run on windows. I would guess mingw is constructed from cygwin, but I wouldn't know. This explains the difference http://www.mingw.org/node/21.
Mingw is not an ide. Cygwin is not an ide.
Mingw is basically gcc with a Bourne Shell interpreter http://www.mingw.org/wiki/MSYS. Your code does not run in this interpreter. your code runs native as a win32 app.
Cygwin is a unix-like environment. Your code runs in this environment.
In short ..
Mingw = build native apps for windows
Cygwin = compile and run unix-like apps on windows.
Code::Blocks is an ide. It can use many compilers. Code::Blocks is cross-platform. Code::Blocks can use gcc, vc++ compiler, mingw( gcc on windows ) and so forth.
You can code with mingw to create win32 apps.
I haven't really used Qt, but I am sure you can use it with Code::Blocks with Mingw since Qt is cross-platform. You need to download the framework and tell code::blocks where this framework is.
-
Re: Question about C++, compilers
Quote:
How should I go about compiling C++ files meant for QT?
Qt is very different from normal C++ libraries. It adds non-standard features to the language, and it includes its own "preprocessor" which you have to put your source files through before feeding them to an actual C++ compiler. You'll have to go to the Qt website for instructions on getting all of that set up.
-
Re: Question about C++, compilers
Quote:
Originally Posted by
ninja9578
Writing C++ on Windows is hell, Windows does not have a make command.
Huh? I must say that having to maintain a makefile is hell compared to using MSVC's project settings... For those that instead love makefiles nmake is part of the express installation package.
-
Re: Question about C++, compilers
If you're writing the project it's fine, try compiling wxWidgets for Visual C++ ;) It's not your programs that makefiles are for, I've only written a few makefiles in my whole life, it's all of the libraries that you end up needing that you wish windows had a make function.
If I remember correctly, nmake isn't make compatible. Libraries all use real make files, not Microsoft's interpretation of how make should work.
-
Re: Question about C++, compilers
Quote:
Originally Posted by
ninja9578
If you're writing the project it's fine, try compiling wxWidgets for Visual C++ ;) It's not your programs that makefiles are for, I've only written a few makefiles in my whole life, it's all of the libraries that you end up needing that you wish windows had a make function.
If I remember correctly, nmake isn't make compatible. Libraries all use real make files, not Microsoft's interpretation of how make should work.
Well, you can always use CMake to generate the project files I guess. There are options, anyway.
-
Re: Question about C++, compilers
Quote:
Originally Posted by
Speedo
Qt is very different from normal C++ libraries. It adds non-standard features to the language, and it includes its own "preprocessor" which you have to put your source files through before feeding them to an actual C++ compiler. You'll have to go to the Qt website for instructions on getting all of that set up.
And in doing so requires you to use the 'make' command. Which I get an error for.
And reading on it seems make is not from qt but your compiler?
So I tried to install minGW stand alone and see what this whole make thing is, but the make command still is not recognized.
All I would like to do is build applications with the qt framework!
So I am totally lost at this point?
-
Re: Question about C++, compilers
Quote:
Originally Posted by Chris Evil
And in doing so requires you to use the 'make' command. Which I get an error for.
A quick check brings up Installing Qt on Windows, which provides examples to the contrary (though it also states that "Open Source Versions of Qt is not officially supported for use with any version of Visual Studio").
Quote:
Originally Posted by Chris Evil
So I tried to install minGW stand alone and see what this whole make thing is, but the make command still is not recognized.
You could use mingw32-make, or install MSYS and then use make. I am afraid that I am not clear of the differences.
-
Re: Question about C++, compilers
Quote:
Originally Posted by
laserlight
I recently build Qt using VS2005 following this guide. You have to read well, take things one step at a time and have some perseverance if you want to make it, but it's not impossible. By the way, I don't think this will be easier using another compiler/IDE.
A few problems I ran into:
- Make sure you have enough disk space. Building debug and release libraries (dynamic only, no static ones) took up 10 GB.
- Make sure you run the commands from the command line tool inside Visual Studio. Don't just run "cmd", else the nmake command/program won't work.
- I had to first build the libraries with support for QT3, which would give errors somewhere halfway, then start again building without support for QT3. Probably due to some incorrect dependency in some library, but I didn't bother to investigate.
-
Re: Question about C++, compilers
Quote:
Originally Posted by
Chris Evil
And in doing so requires you to use the 'make' command. Which I get an error for.
And reading on it seems make is not from qt but your compiler?
Mostly correct. The make utility is sometimes provided by a compiler install, sometimes as a stand-alone utility. More on this below.
Quote:
So I tried to install minGW stand alone and see what this whole make thing is, but the make command still is not recognized.
All I would like to do is build applications with the qt framework!
So I am totally lost at this point?
Not at all. I haven't tried this in a while, but Nokia supports an IDE and compiler for every platform QT is supported on:
Quote:
Qt Creator is a new cross-platform integrated development environment (IDE) tailored to the needs of Qt developers. Qt Creator is available bundled together with the latest Qt libraries and additional development tools as part of the Qt SDK, which provides everything you need to get started with cross-platform Qt development in a single install.
Go to the QT downloads page and download the Qt Creator 2.0.0 Binary for Windows. It should give you everything you need to create and build QT projects. I believe there is even a set of tutorials built in.
Quote:
Apart from what they are, is there no 'native' make command for windows? So are you not mean/encouraged to compile C++ files with windows?
Windows is distributed as a general purpose operating system. You are supposed to install whatever applications you need to make it what you want (at least, that's the theory). :D As such, it doesn't have native tools for a lot of things.
If you want to do code development, you have to find/buy all the tools you need and install them. Make is not provided as part of the "out of the box" Windows install. I'm not familiar with what is provided by MinGW, although it appears from their web site that make is in there in some fashion (either as part of MinGW or from the msys add on, or both). At one time, Borland C++ also provided a make utility (in the bin folder), not sure if it still does or not. Cygwin can also install make for you. As others have said, Visual Studio provides nmake, which is not fully compatible with make.
Quote:
A quick check brings up
Installing Qt on Windows, which provides examples to the contrary (though it also states that "Open Source Versions of Qt is not officially supported for use with any version of Visual Studio").
Note that this appears to be using the Daily Dev Snapshot of QT which is not something I'd recommend for someone just starting out.
Hope this helps you out. Again, the first thing I would try is using the QT provided IDE as that's where you'll get the best QT support. Good Luck!
-
Re: Question about C++, compilers
What I asked about a native make command for windows, what I meant is does it natively have any support for this make command?
I do have qt creator. And it does work, was just interested to get it to 'compile' projects on a more low level - just to understand this whole compilation, QT framework thing...
As for QT with visual studio that's not really what I'm looking for..
Hmmmm...
Would it be an easy task to write a C++ source file with notepad and compile it with MinGW? Without using code::blocks?
-
Re: Question about C++, compilers
Yeah, not that hard to compile using gcc.
-
Re: Question about C++, compilers
Quote:
Originally Posted by
Chris Evil
What I asked about a native make command for windows, what I meant is does it natively have any support for this make command?
I thought I answered that:
Quote:
Windows is distributed as a general purpose operating system. You are supposed to install whatever applications you need to make it what you want (at least, that's the theory). As such, it doesn't have native tools for a lot of things.
If you want to do code development, you have to find/buy all the tools you need and install them. Make is not provided as part of the "out of the box" Windows install. I'm not familiar with what is provided by MinGW, although it appears from their web site that make is in there in some fashion (either as part of MinGW or from the msys add on, or both). At one time, Borland C++ also provided a make utility (in the bin folder), not sure if it still does or not. Cygwin can also install make for you. As others have said, Visual Studio provides nmake, which is not fully compatible with make.
Am I just not understanding your question? :confused:
-
Re: Question about C++, compilers
The original problem was "working" Qt...
I really recommend to download (and install) the Qt SDK for Windows, witch comes bundled with MingW compiler (and make tool) with qmake (tool specific to Qt for project files, running their "compilers" <moc and uic> that generate c++ code, that can be compiled by mingw) and everything running out_of_the_box (just install and works with Qt Creator IDE)
You just need to add to the PATH if you want to run Qt applications without coping the dll's.
NOTE: if you try to integrate Qt with Codeblocks or other compiler/IDE you will need to provide some batch files (compiler options... etc) to run qmake on the Qt files (the ones with Q_OBJECT classes) because if you don't, the c++ compiler doesn't know what signals/slots(and other Qt language above C++) are, so you can't build from the IDE.
There are some plug-ins for Visual Studio and Eclipse that include all the tools (and possibly you need to build Qt from source, but for VS i think they give pre-build Qt libraries, but i'm not sure, i use Qt Creator for Qt applications ;) )
LE: the link is to the open source (LGPL) version of Qt.