problems compiling

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
batteryphil
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 5
Joined: Sun Apr 05, 2009 11:54 am

problems compiling

Post by batteryphil »

I have bought c++ for dummies and downloaded dev c++. The problem is I can't get it to compile. I am new so don't be to hard on me. Is there a setting I may have wrong or is it vista? I have tried other compilers and none of them will compile. Please help.
herby490
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Thu Feb 12, 2009 5:59 pm

Re: problems compiling

Post by herby490 »

could you post your code and the error it gave you.
batteryphil
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 5
Joined: Sun Apr 05, 2009 11:54 am

Re: problems compiling

Post by batteryphil »

The code is just the maine. In the book it says it will open a console window and say "press any key to continue".
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
But instead it gives this error
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Dev-Cpp\myfirstproject\main.cpp" -o "C:\Dev-Cpp\myfirstproject\main.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
/mingw/lib/crt2.o(.text+0x37):crt1.c: undefined reference to `__cpu_features_init'
collect2: ld returned 1 exit status

Execution terminated
Did I miss something I was supposed to do? I have no idea what any of that means yet?
herby490
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Thu Feb 12, 2009 5:59 pm

Re: problems compiling

Post by herby490 »

It runs fine when compile it. When I ran it. When you downloaded dev-c++ did you get it with or without mingw. Also try this code it will do the same thing as yours with a few things taken out.

Code: Select all

#include <iostream>

int main()
{
system("PAUSE");
return 0;
}
you do not need using namespace std unless you are working in the standard namespace i.e. cout, cin, cerr etc.
batteryphil
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 5
Joined: Sun Apr 05, 2009 11:54 am

Re: problems compiling

Post by batteryphil »

I tried what you posted and it didnt work either. It must be the mingw. What is that and how do I get it into dev c++.
herby490
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Thu Feb 12, 2009 5:59 pm

Re: problems compiling

Post by herby490 »

Dev-C++ is an IDE(Integrated Developers Environment). An IDE is basically point and click and press a button to compiler(assuming you have an compiler to go with it). If you don't have a compiler to go with it an IDE is essentially notepad with a few extra features. Mingw on the other hand is a compiler that unless you have a IDE to go with it has to be run from the command line. So if you got Dev-C++ by itself then you will not be able to compile any code. For the day or two that I used Dev-C++ I know that it runs fine on vista(and windows 7 if it matters). I hope my explanation is ok. I am sure there is a better way to explain it.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: problems compiling

Post by dandymcgee »

Could download Code::Blocks :P There's a win32 installer that includes MinGW.
http://downloads.sourceforge.net/codebl ... -setup.exe

Haven't used Dev-C++ in ages so as far as setting up the compiler I really don't remember.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
herby490
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Thu Feb 12, 2009 5:59 pm

Re: problems compiling

Post by herby490 »

dandymcgee wrote:Could download Code::Blocks :P There's a win32 installer that includes MinGW.
http://downloads.sourceforge.net/codebl ... -setup.exe

Haven't used Dev-C++ in ages so as far as setting up the compiler I really don't remember.
Yeah I would use Code::Blocks or Visual C++. Dev-C++ is kinda old.
batteryphil
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 5
Joined: Sun Apr 05, 2009 11:54 am

Re: problems compiling

Post by batteryphil »

I'm downloading codeblocks now. Thanks for the advice guys! I'll let you know if this solves the problem.
batteryphil
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 5
Joined: Sun Apr 05, 2009 11:54 am

Re: problems compiling

Post by batteryphil »

Works Great guys! Thanks a lot.
herby490
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Thu Feb 12, 2009 5:59 pm

Re: problems compiling

Post by herby490 »

I am glad it works for you.
Post Reply