Undefined reference error
Mar 20, 2012 at 8:43am UTC
I get the following error when i compile my code, any ideas?
Thanks!
1 2 3 4
i:\gw\lib\crt2.o(.text+0x8) In function `_mingw_CRTStartup':
[Linker error] undefined reference to `__dyn_tls_init_callback'
[Linker error] undefined reference to `__cpu_features_init'
i:\gw\lib\crt2.o(.text+0x8) ld returned 1 exit status
I don't think my code is necessary, but here it is anyway:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
//Includes
#include <iostream>
#include <string>
#include <ctime>
#include <windows.h>
using namespace std;
//Initialization
void timer();
void changeLines();
void changeBinary();
void printLines();
string hms2str();
//Public variables
bool firstTime = 1;
string sLine1 = " 0 0 0" ;
string sLine2 = " 0 0 0 0 0" ;
string sLine3 = "0 0 0 0 0 0" ;
string sLine4 = "0 0 0 0 0 0" ;
string sLineSplitter = "---------------" ;
string sLineTime = "0 0 : 0 0 : 0 0" ;
string sTime;
string sHour, sMinute, sSecond;
int main(int argc, char *argv[]) {
timer();
sTime = hms2str();
cout << sTime << endl;
return 0;
}
void timer(){
a:
if (firstTime == 0){
Sleep(1000);
}
changeLines();
printLines();
goto a;
}
string hms2str(void ) {
char s[9];
time_t now;
struct tm *t;
time(&now);
t = localtime(&now);
strftime(s, sizeof (s), "%X" , t);
return string(s);
}
void changeLines(){
sTime = hms2str();
sHour = sTime[0] + " " + sTime[1];
sMinute = sTime[3] + " " + sTime[4];
sSecond = sTime[6] + " " + sTime[7];
changeBinary();
}
void changeBinary(){
//Code
}
void printLines(){
system("CLS" );
cout << sLine1 << endl;
cout << sLine2 << endl;
cout << sLine3 << endl;
cout << sLine4 << endl;
cout << sLineSplitter << endl;
cout << sHour << " " << sMinute << " " << sSecond << endl;
}
Mar 20, 2012 at 10:32am UTC
Topic archived. No new replies allowed.