【发布时间】:2014-02-04 04:27:01
【问题描述】:
在 Ubuntu 12.04.3 中编译代码一段时间后,我决定尝试在 Windows 中进行编码并安装 MinGW。安装后,我设置了路径变量,gcc 似乎可以工作。但是,某些代码(尤其是包含多个文件的代码)无法使用在 Ubuntu 上使用的相同命令进行编译,并且 MinGW shell 中会显示各种错误消息。这是预期的行为还是我做错了什么?感谢您的帮助。
P.S: 显示错误信息
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
编辑:错误似乎与编译阶段的 QROMO.c 和 POLINT.c 有关。收到的错误信息如下:
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");
^
【问题讨论】:
-
请弄清楚如何从 cmd.exe 窗口复制文本(是的,有可能,是的,这很痛苦)或使用
> log.txt 2>&1重定向输出并将其发布到 Stackoverflow。您仍然可以更新您的问题。 -
@rubenvb 做对了也不算痛苦,不能作为借口。
-
@glglgl 这很痛苦,因为在 cmd 窗口中,行被剪切的地方,而不是换行符的地方。
-
@rubenvb 哦,是的,没错,唉。我想知道为什么他们会创造出如此无用的东西……尽管如此,它是可以使用的,因此不能作为借口。
-
我按照指示将输出重定向到文件并从那里进行复制粘贴操作。如果可能的话,我还想知道为什么该命令需要两个 >。
标签: c windows mingw ld undefined-reference