problems compiling
Moderator: Coders of Rage
-
- Chaos Rift Newbie
- Posts: 5
- Joined: Sun Apr 05, 2009 11:54 am
problems compiling
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.
Re: problems compiling
could you post your code and the error it gave you.
-
- Chaos Rift Newbie
- Posts: 5
- Joined: Sun Apr 05, 2009 11:54 am
Re: problems compiling
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?
#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?
Re: problems compiling
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.
you do not need using namespace std unless you are working in the standard namespace i.e. cout, cin, cerr etc.
Code: Select all
#include <iostream>
int main()
{
system("PAUSE");
return 0;
}
-
- Chaos Rift Newbie
- Posts: 5
- Joined: Sun Apr 05, 2009 11:54 am
Re: problems compiling
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++.
Re: problems compiling
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.
- dandymcgee
- 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
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.
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!
Re: problems compiling
Yeah I would use Code::Blocks or Visual C++. Dev-C++ is kinda old.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.
-
- Chaos Rift Newbie
- Posts: 5
- Joined: Sun Apr 05, 2009 11:54 am
Re: problems compiling
I'm downloading codeblocks now. Thanks for the advice guys! I'll let you know if this solves the problem.
-
- Chaos Rift Newbie
- Posts: 5
- Joined: Sun Apr 05, 2009 11:54 am
Re: problems compiling
Works Great guys! Thanks a lot.
Re: problems compiling
I am glad it works for you.