Using eclipse to compile c++ [duplicate] - c++

This question already has answers here:
Getting C++ to compile inside Eclipse
(2 answers)
Closed 9 years ago.
I am new to c++ but have some programming experience with R and Matlab. My OS is Win 7.
I downloaded " Eclipse IDE for C/C++ Developers " from Eclipse website and tried to run a simple program, but the compiler doesn't even know "cout", the simplest c++ command.
I do see some answers on the website, but it is still a little hard for me to follow.
Eclipse CDT: Symbol 'cout' could not be resolved
First of all, should I install "Eclipse Standard 4.3" ( the so called platform?) or " Eclipse IDE for C/C++ Developers " ? Most of the documents I found on the web use the platform rather than C++ IDE.
Could someone recommend a step to step guide (guide for "idiot" like me ) for programming c++ with eclipse?
Thank you very much!

Either the C++ specific version or the standard version should work. What I believe is happening with you is that you don't have a C++ compiler installed. gcc is the most popular one, just Google it. Do note that Eclipse is not a compiler and it does not include a compiler, either.
As for a guide, a quick google search found the Eclipse C++ documentation. As you are new to StackOverflow, please be sure to read the guidelines, and go over the about page to get acquainted with how the site works.
Also see this related question. Let me know if you have any questions, and welcome to the community!
My suggestion on the matter, if you are new to IDEs, you may want to start with Visual Studio. It is very easy to use, and the express edition is free. I believe it includes a C++ compiler as well.

Related

Compile C++ program without .NET Framework [duplicate]

This question already has answers here:
Standalone VS 2010 C++ Program
(5 answers)
Closed 7 years ago.
I'm trying to compile my c++ program I wrote without using .NET Framework (I needit to be, at the end, an EXE file).
These are my includes:
stdio.h, tchar.h, windows.h, string.h, iostream, thread, Wbemidl.h, memory, algorithm, WinHttpClient.h, functional , cctype, locale.
When I try to compile and run this program in VS (adding the stdafx.h) the program works just fine, but it compiles with the .NET framework.
How can I compile it without the .NET Framework? Is it even possible? (I believe it is but I'm asking anyway).
I tried to use both mingw32 in Ubuntu and code::blocks in windows. Maybe I'm doing something wrong?
Thank you.
Edit:
This question is not the same as the question you marked mine to be similar to.
I can't and I don't want to rely on the fact that the destination computer has redistributable packages or .NET or some MSVCP. In the end, this program should work on Windows XP and above and on most of the Linux distributes.
Please, I need your help. I might said something wrong earlier in this topic, and I'd like you to explain me my mistakes and also, I still need your help to compile this.
I tried to change the settings you told me on VS, to /MT in the code generation settings, but it gave me even more errors that it cannot open some source files, which makes even more error.
I thought about leaving VS 2015 and move to code::blocks on Ubuntu, even compiling with the MingW32 itself, but it writes me "undefined reference to..." 49 times (all the functions defined in the header files I included).
I'd really appreciate any help.
Do you actually know, what the difference between .NET and WinApi is?
If you plan to code without .NET you should have a look at win32developer.
An alternative would be to use Qt, which I warmly recommend you to use.
.NET provides many functions for networking and window handling etc. like Java but it is WINDOWS ONLY and since you don't want to depend on .NET you have to either implement it yourself or get another package like I suggested above.

How to set compiler in eclipse to use borland C++ Builder 3?

I know this is a pretty strange question, but I have new project that I have to refactor a code that was written long time ago using Borland C++ Builder version 3.0
It is almost impossible to refactor and use that IDE to keep track of refactoring. I am not sure if it possible but I want to see if I can use Eclipse and set the Eclipse to use Borland C++ Builder as the compiler.
Please let me know if there is any IDE that can help me. Also please do not give answers like, why using Borland C++ Builder or rewrite the code.
I will appreciate your help.
Thanks in advance!
C++Builder 3 did not support refactoring. That was added in C++Builder 2006 (but is very limited compared to the refactorings available to Delphi, which uses the same IDE).
It is possible to configure Eclipse to invoke a custom C++ toolchain. C++Builder 3 has a command-line compiler, bcc32.exe, and a command-line linker, ilink32.exe.

Cross compilation tutorials [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Cross platform programming
I've written some code using wxwidgets in c++. But I am not able to compile the same code for both windows and linux. Actually I'm a bit scared by the preprocessor directives generated by code-blocks ide. I wonder if anyone could point out some nice tutorials for learning cross-compilation.
Thanks in Advance
Jvc
If you want to build a cross platform program, you will stumbl across a few kind of problems.
Cross compilers problem
Some compilers are offering non-standard functionalities that might not work on other compiler. You have to make sure that compiler functionnalitie's you use are standard or available on all the compilers you use (An exemple would be the VC++ #pragma that wasn't usable on gcc until version 4.2.1)
Platform specific functions and libraries
Guess what, if you include <windows.h> it won't compile on a linux system (this is madness I know). So you must try to avoid those platform specific libraries/function. If you ever have to use them, try to encapsulate their use and select the specific class you need to compile on different system.
Here is a wonderful guide posted by the Mozilla foundation :
https://developer.mozilla.org/en/C___Portability_Guide
You could have a look at Cross Compiling wxWidgets Applications on Linux (Code::Blocks wiki) and Cross-Compiling Under Linux (wxWiki). There is also a section on cross compiling Windows applications in Brent W. Woodruff C++ Introduction to wxWidgets.

Eclipse CDT vs NetBeans C++ vs [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Best C++ IDE or Editor for Windows
Hello, everyone.
For a long time now, for C/C++ development, I have been using Notepad++ and the command line for compiling C/C++ programs. Now, I want to start using an IDE, and I have tried out quite a few. Currently, I am thinking of either Eclipse CDT or Netbeans C++, but other suggestions are welcome too. The problem is that I cannot find any recent, unbiased comparisons of both of these softwares. So, I would like to hear opinions on which IDE is better. By "better", I mean in terms of code-completion, configurability, ease of use, speed, and especially debugging capabilities and debugging speed. I really need help on choosing a C/C++ IDE. Thanks!
EDIT:
Because I develop on both Windows and Linux, I need an IDE that is compatible with both Windows and Linux, and by default uses GCC by default, so Visual Studio is not an option for me. Thanks!
I have used Eclipse for years, and it is a solid IDE with a wide range of capabilities. If you haven't tried it out to see how well it fits your needs, I would recommend giving it a shot.
That being said, I have recently started using NetBeans and I must say that I like it a bit better than Eclipse. It seems to be more streamlined than Eclipse (less memory usage, faster to start up, etc). I have not tested its built-in debugging capabilities however, so I can't say anything on that front.
Thankfully, there are a number of freely-available, quality IDEs out there. I would recommend installing a handful and trying to perform the same basic set of tasks in each (create a new project, add in your source code, build, run, debug, etc) and see how they feel. Pretty quickly, you should start to get a feeling about which ones meet your needs and which are lacking.
After your question edit:
I'd strongly recommend Code::Blocks: http://www.codeblocks.org/
I'd like to throw in my vote for Visual Studio.

C on Visual Studio [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm trying to learn C. As a C# developer, my IDE is Visual Studio. I've heard this is a good environment for C/C++ development. However, it seems no matter what little thing I try to do, intuition fails me. Can someone give good resources for how to either:
learn the ins and out of C in Visual Studio
recommend a better C IDE + compiler
Edit: See also: https://stackoverflow.com/questions/951516/a-good-c-ide
well you can use visual studio just fine take a look at here man
http://www.daniweb.com/forums/thread16256.html
Go to View Menu select Solution Explorer or CTRL+ ALT +L
Then Select The project that your are developing and right click on that.
Then select the Properties from the submenu.
Then select the Configuration properties from the Tree structure. under that select C/C++ then select Advanced. Now in the right side pane change the property
Compile As from Compile as C++ Code (/TP) to Compile as C Code (/TC)
Finally change your file extensions to .c
Now you configured you Visual Studio to compile C programs
And you can use NetBeans too it could even be more user friendly than Visual Studio download it you wont regret i promise
The problem with learning C within Visual Studio is that you are compiling C using the Visual Studio C++ compiler. You might want to try learning C using the GNU GCC compiler from within the Cygwin environment in Windows.
Answering the purely subject question "recommend me a better C IDE and compiler" I find Ming32w and Code::blocks (now with combined installer) very useful on windows but YMMV as you are obviously used to the MS IDE and are just struggling with C.
May I suggest you concentrate on console applications to get a feel for the language first before you attempt to tie it together with a windows UI which in my experience is the hardest bit of windows development.
Simple and sweet: Console applications (basic C programs using printf and such) are easily and cheaply done with the Tiny C Compiler - a no frills, no gui, complete C complier.
http://bellard.org/tcc/
However, C development is relatively simple on Visual Studio as well. The following instructions will set Visual C++ up as a good C compiler, and it will produce console applications at first, and yo can move up into more complex windows apps as you go.
Get the Visual Studio C++ edition (express is fine)
Start a new project - disable pre-compiled headers (maybe the wizard will let you do this, maybe you'll have to change the compiler settings once inside the project)
Delete everything inside the project.
Create a new "example.c" file with the hello world example
Compile and away you go.
Alternately, get a linux virtual machine, or Cygwin. But as you already have Visual Studio, you might as well stick with what you know.
As an aside, this isn't Atwood learning C finally, is it? No ALTs! ;-D
-Adam
Bloodshed Dev-C++ is the best windows C/C++ IDE IMO: http://www.bloodshed.net/
It uses the GNU compiler set and is free as in beer.
EDIT: the download page for the IDE is here: http://www.bloodshed.net/dev/devcpp.html
As already said, you should check out the VS.net C++ edition, but if you'd like to try something else Eclipse has a C++ edition. You can get more info from http://eclipse.org or check out the distro at http://www.easyeclipse.org/site/distributions/cplusplus.html
The problem with learning C within Visual Studio is that you are compiling C
using the Visual Studio C++ compiler. You might want to try learning C using
the GNU GCC compiler from within the Cygwin environment in Windows.
This is a legitimate response, I posted an IDE that uses the GNU compilers, so why has he been down modded?
This is the type of thing that will make me not use SO, why down mod someone just because they are recommending a different compiler, and IMHO, a better one then Microsoft's?
get real people, and #Antonio Haley I gave you +1
http://xoax.net/comp/cpp/console/Lesson0.php
Any use?
Some people say that a smaller IDE is better for learning. Take a look at Code::Blocks. It's generally true that beginning C in an IDE is hard because not many books explain enough to control the IDE. Perhaps starting in a console and a basic text editor with syntax highlighting would be better – at least under Linux. Since Windows' console is far from great, I'd not recommend using it.
/EDIT: Dev-C++ used to be the best freely available IDE for Windows. However, it's development has been discontinued years ago and the most recent version unfortunately is full of bugs.
There's a very good reason to learn C and C++. The reason is that there's a lot of C and C++ code out there that are performing very real and important tasks. Someone who considers themselves a programmer and a learner(doubtful that you can separate the two) can learn a lot from these lines of code.
You can learn a lot from each language by studying the other, but if you really want to grok C it's a lot easier to separate yourself from anything C++ for a while. Visual C++ is great but GCC is a great way to thrust yourself into vanilla ANSI C without having to mentally sidestep any C++.
#mmattax thanks!
C in Visual Studio is fine, just use the command line compiler that is included in the Pro edition. Yes its the C++ compiler but treats all files ending .c as C . You can even force it to treat ALL files as C with a switch. The VS documentation has entries on it, just search the index for Visual C.
Visual Studio is one of the best IDEs for C/C++.
I don't think it is complicated and hard to use - if you have questions about it - ask them.
Some other compilers/IDEs are fine too, but if already have Visual Studio and have used it - why not stick to it?
For plain C, I suggest Pelles C. Generates optimized code and supports C99 constructs.
Features:
Support for 32-bit Windows (X86),
64-bit Windows (X64), and Windows Mobile (ARM). Support for the C99 standard.
Integrated source code editor with call tips and symbol browsing. Integrated source-level
debugger. Project management.
Inline assembler for X86 and ARM.
Integrated resource editor. Integrated bitmap, icon and cursor editor. Integrated
animated cursor and video editor.
Integrated hex-dump editor.
Supportfor custom controls in the dialog editor. Support for custom project wizards.
http://www.smorgasbordet.com/pellesc/
When i used visual studio 5.0 it should compile c code as long as the header files and lib. are there for the compiler to find. In fact most C++ compilers like G++ will compile C code just fine. But i'm not sure how well.. If you are targeting a platform then you can change the header files and lib. within you IDE and Compiler.
Visual Studio has a great debugger that no other Compiler that i have seen can compete with. I have been using gcc darwin10 4.2.1 and find the debugger is basically just the one you can getfree with any linux flavor. I recommend you learn both on a plain vanilla gcc compiler and also try visual studio which costs money. The express edition does not allow the use of threading and several other things that I forgot about. Visual Studio 5.0 should be ok to use and the debugger is much more human friendly then the one commandline version called GDB. Try DDD on linux which is similar to XCODE's debugger.
Although C++ and C are different you can compile both together. But you should understand each ones flaws and good points. C code is faster, but C++ is much easier to write and manage larger code. C++ is object oriented but C is procedural while they are both imperative languages. I would suggest learning objective-C since you can use both C++ and C libraries. Using the features you like in all three languages!!!
Visual Studio or Express do consider .c files as C code, but the compiler will keep giving warnings, and irritating suggestions which you do not require, in the debugger. Gives an indication that Visual C++, as the name suggests is optimized for C++ development for the Windows Operating system, which was originally written in plain pure C.