-
Dev.c++ blooshed help
(still need help and please note i get this error for whenever i try and compile and run any program no matter how simple or advanced)
I downloaded bloodshed dev.c++ program for c++
its the program that we are using in school for the class
I type in the program perfectly no problems or whatever but i get an error when i try and compile it it says
[Linker error] undefined reference to `__cpu_features_init'
ld returned 1 exit status
(note this is the file) C:\Dev-Cpp\My Projects\Makefile.win
(this is the error message) [Build Error] [Project1.exe] Error 1
here is what im trying to compile and run its pretty simple and ive tried even simpler ones the
cout << "Hello World"<<;
one also but i get the same error
Code:
#include <iostream>
using namespace std;
int main()
{
int num1,num2;
float average;
cout << "Hello World!"<< endl;
cout << "Press Enter to continue..." << endl;
cin.get();
cout << "Enter an integer betweeen 1 and 10"<<endl;
cin >> num1;
cin.get();
cout << "Enter an integer between 11 and 20";
cin >> num2;
cin.get();
average=(num1+num2)/2;
cout << "Average=" << average << endl;
cin.get();
return 0;
}
im running on a gateway media center so im thinking that maybe im missinig some program?? but i have no idea
if anybody is using this program or have used it and have any ideas please help
please be specific in details im just a beginner to c++
-
I think that the problem maybe that you need to include cstdlib when you compile, but I'm not 100% on that.
-
umm im just starting c++ coud you be a little or a lot more specific
-
you need to include the cstdlib in the project, so at the top of the code (just under the previous include), put:
I think that should solve the problem.
-
hm nope i ran this program on the school computers just fine no idea why this wouldnt work
-
The code is fine, <cstdlib> isn't needed for anything in there.
Something seems wrong with the way Dev-C++ or your project is setup. Did you find any extra information when you searched for that error message?
-
Linker errors on something that simple usually means it wasn't installed correctly(The filed your including can't be found, or the files for Dev can't be found). I recommend uninstalling, and re-installing it carefully. Also one thing you might want to try is in Dev, you don't really need a project, for something that small it's kind of useless. I also suggest trying to get rid of the project, and just use one source code cpp page. I'm thinking that you might have clicked "A simple windows application" for your layout, or something of that sort, so just try it with just source code.
-
Can you do a "Rebuild All", then paste everything which appears in the "Compile log".
Then we can see the actual commands which lead up to the failed linking.
-
I got it fixed guys. For anybody that has this problem i had to uninstall the program.
then manually remove all of the left over files on my computer.
i had installed it once before but uninstalled it becouse it was the wrong version
and if the old left over files interact iwth the new dev.c++ files they get all messed up.
-
On a side note try to get out of the habbit of using
Code:
using namespace std;
Either prefix the name space objects with std:: like this:
Code:
std::cout << "Hello World\n";
Or you can declare all namespace objects before you use them under their header file like this:
Code:
#include <iostream>
using std::cout;
using std::cin;
Just a small tip thats all :)