Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hello, I'm trying to learn C programming but I have an issues with my compiler. Im using Dev++ but I cant compile. I get this error message saying that g++ is not working. Can you help me? Or recommend me another IDE, free or with a price? Please, Im really worried about this.
Posted
Updated 30-Apr-15 12:51pm
v5
Comments
Garth J Lancaster 28-Apr-15 22:01pm    
well, why don't you post more information on this ... "I get this error message saying that g++ is not working." so people can see if they can help you fix that issue as well, rather than swap tool-chains

I'd also drop the guys at Bloodshed software a line with your issue - the exact error message, what version you have etc, and see if they can help you - their email address is webmaster@bloodshed.net
Sergey Alexandrovich Kryukov 28-Apr-15 23:23pm    
Help with what? Are you going to blame the compiler? This way, you won't go far, I'm afraid...
—SA
CPallini 29-Apr-15 5:04am    
You possibly are having troubles with the Integrated Development Environment.
chandanadhikari 29-Apr-15 9:06am    
just a suggestion: in case you decide to go for Visual Studio, then you have another option to go for Visual Studio 2013 Community Edition instead of the Express edition. It does not have the limitations of the express edition and is a free download .
explore more here::
https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx
Albert Holguin 6-May-15 19:14pm    
I'd stick with gcc/g++ for a beginner. If you ever venture into the Linux world, that is by far the most widely used compiler. In windows you can use them through Cygwin or MinGW. For starting out, I'd also recommend you compiling your simple programs through the command line/terminal and work your way up to an IDE.

Visual Studio Express?
https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx[^]

There is also Quincy.
http://www.codecutter.net/tools/quincy/[^]

I also use ye olde Borland C/C++ Free tools and MinGW.


You're unlikely to find a C compiler that doesn't also do C++.
 
Share this answer
 
v2
Comments
[no name] 28-Apr-15 22:37pm    
Have you used Eclipse?
PIEBALDconsult 29-Apr-15 0:06am    
For Java/Android, briefly.
[no name] 29-Apr-15 0:57am    
On reflection probably not for beginner.
Albert Holguin 5-May-15 11:37am    
Eclipse is an IDE, not a compiler.
CPallini 29-Apr-15 5:03am    
"You're unlikely to find a C compiler that doesn't also do C++."
LCC, PellesC, TCC, for instance.
No, you don't have issues with your compiler. Or, more exactly, this is very unlikely. g++ is a decent compiler, but it's for C++, not C; for C, you run gcc. Please see: http://en.wikipedia.org/wiki/GNU_Compiler_Collection[^].

Chances are, your problem is not a compiler, but your code, and, very likely, your understanding of what you are doing.

GNU, Microsoft, Intel compilers should be good enough for you. And you did not ask about IDE, only mentioned Dev+ (Dev-C++?), but this is not all. This is a whole different story.

[EDIT]

About your code:

This is the syntax error:
C++
scanf(" %d". &year1);

Should be:
C++
scanf(" %d", &year1);

Besides, declaration
C++
int year1, year2;
outside the function is quite pointless.

—SA
 
Share this answer
 
v4
Comments
CPallini 29-Apr-15 5:03am    
5.
Sergey Alexandrovich Kryukov 29-Apr-15 8:59am    
Thank you, Carlo.
—SA
CristianCruz503 29-Apr-15 15:54pm    
This the message I get on the pop up when I try to compile. " g++.exe has stopped working A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available." and then it gives me the option to "Debug" or "Close program"
CristianCruz503 29-Apr-15 15:55pm    
/* Program to calculate what year someone will turn a specific age */
#include <stdio.h>
#define TARGET_AGE 88

int year1, year2;

int calcYear(int year1);

int main(void)
{
// Ask the user for the birth year
printf("What year was the subject born?: ");
printf("Enter as a 4-digit year: ");
scanf(" %d". &year1);

// Calculate the future year and display it
year2 = calcYear(year1);

printf("Someone born in %d will be %d in %d.",
year1, TARGET_AGE, year2);

return 0;
}

/* The function to get the future year */
int calcYear(int year1)
{
return(year1+TARGET_AGE);
}

And this the code I've tried to compile.
Sergey Alexandrovich Kryukov 29-Apr-15 16:09pm    
Did you pay attention that your first like is "#include"?
—SA
To develop only for plain C the best solution is PellesC[^], a full suite for 32/64bits development, including an IDE to create/edit sources and resources. The suite includes a compiler and an assembler MASM compatible. The resource editor is able to handle almost all resource types: dialogs, images, icons, manifest, xtml, etc. A really small, efficent and fast compiling suite.
There is also a forum[^] where you'll find sources in contributions section and many IDE extensions in ADDINS section.
 
Share this answer
 
Comments
CPallini 29-Apr-15 5:03am    
5.
Frankie-C 29-Apr-15 7:34am    
Thanks
CristianCruz503 29-Apr-15 15:57pm    
Thank You Frankie-C I have downloaded the program and I will give it a try. I appreciate it!
The problem with your code is that the g++ compiler is invoked with switch '-ansi'.
This option enables compatibility with c89 ansi. In this version many 'advanced' features like '//' c++ style comments are not recognized. (see[^]).
To solve the problem you must use the switch '-std=c99' or '-std=gnu99', and for advanced feature '-std=c9x' or '-std=gnu9x'. Before you ask me: no I don't know how to set this using quincy...
Once again if you are really interested to plain C (not C++) and Win OS I suggest to use PellesC that give you the choice of the newest standard versions: C99 & C11 ;)
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900