Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined references only using MinGW GCC

After compiling codes in Ubuntu 12.04.3 for a while, I decided to give coding in Windows a go and installed MinGW. After the installation I set my path variables and the gcc seemed to work. However, some codes(especially those including multiple files) cannot be compiled with the same command used on Ubuntu and various error messages are displayed in the MinGW shell. Is this the expected behavior or am I doing something wrong? I appreciate your assistance.

P.S: Displayed error message

 QROMO.C: In function 'float qromo(float (*)(float), float, float, float (*)(float (*)(float), float, float, int))':
QROMO.C:24:43: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  nrerror("Too many steps in routing qromo");
                                           ^
C:\Users\dell\AppData\Local\Temp\ccUdzH1p.o:Q2.c:(.text+0xd5): undefined reference to `midexp'
C:\Users\dell\AppData\Local\Temp\ccUdzH1p.o:Q2.c:(.text+0xf3): undefined reference to `qromo'
C:\Users\dell\AppData\Local\Temp\ccUdzH1p.o:Q2.c:(.text+0x115): undefined reference to `qgaus'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\Users\dell\AppData\Local\Temp\ccUdzH1p.o: bad reloc address 0x20 in section `.eh_frame'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status

Edit: The errors seem to be related with QROMO.c and POLINT.c during compilation stage. The received error messages are as follows:

POLINT.C: In function 'void polint(float*, float*, int, float, float*, float*)':
POLINT.C:28:62: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
    if ( (den=ho-hp) == 0.0) nrerror("Error in routine polint");
                                                              ^


QROMO.C: In function 'float qromo(float (*)(float), float, float, float (*)(float (*)(float), float, float, int))':
QROMO.C:24:43: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  nrerror("Too many steps in routing qromo");
                                           ^
like image 243
Vesnog Avatar asked Oct 27 '25 14:10

Vesnog


1 Answers

Since you're getting the error:

warning: deprecated conversion from string constant to 'char*'

I guess you're compiling using C++ compiler as the C++11 deprecating conversion from string constant to 'char*'.

§ C.1.1
char* p = "abc"; // valid in C, invalid in C++

You cannot get this error if you're compiling with a C compiler as this conversion still valid in C.

Compiling with a C++ compiler can generate many errors if your program is not C++ compatible.

So just make sure to compile using a C compiler.

like image 164
rullof Avatar answered Oct 29 '25 05:10

rullof



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!