博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nm: test.o: File format not recognized的原因和解决方案
阅读量:4142 次
发布时间:2019-05-25

本文共 563 字,大约阅读时间需要 1 分钟。

        最近写makefile,  碰到了nm: test.o: File format not recognized这个错误, 一起看看:

        test.h:

void output();
        test.cpp:

#include 
#include "test.h"void output(){ printf("c is good\n");}
         编译:

xxxxxx:~/mkfile> g++ -c test.cpp test.h -o test.oxxxxxx:~/mkfile> nm test.onm: test.o: File format not recognizedxxxxxx:~/mkfile>
         奇怪了吧? 原因是多了test.h文件, 根本没必要啊, 编译器会自动去找的, 只要你指定了目录即可。  如果把test.h和test.cpp的顺序调换, 则提示:

xxxxxx:~/mkfile> g++ -c test.h test.cpp -o test.og++: cannot specify -o with -c or -S with multiple filesxxxxxx:~/mkfile>
          这一点, 我们在前面已经说过了。

          看来, 有-o的时候, 你再去搞-c指定多个文件, 那就是天大的坑。

转载地址:http://gnwti.baihongyu.com/

你可能感兴趣的文章
cf919的ABC(太咸nowatashi)
查看>>
ASCII Area UVA - 1641 WA原因总结(没有脑子
查看>>
vjudge新手常见错误(误)和好习惯18.2.23
查看>>
UVA455水题目字符串(最长相等emm)
查看>>
UVA11346带图
查看>>
UVA10059暴力初步
查看>>
The Dole Queue UVA - 133(依次抓走做夫妻肺片)
查看>>
UVA10976摸鱼的暴力枚举初步.....
查看>>
UVA514 Rails 栈初步..
查看>>
UA489 变态啊= -Hangman Judge 刽子手
查看>>
第一周天梯赛(??) hdu1401坑爹的生日&&ac me 26个英文字母
查看>>
HDU1408 盐水的故事
查看>>
Codeforces #467 (Div. 2) B. Vile Grasshoppers 蚂蚱的题目
查看>>
CF934a 孩子和灯笼!
查看>>
CCCC周六/水仙花数/hdu1408,完数/
查看>>
速戳!小白看 超详细bfs入门/迷宫问题POJ3984
查看>>
bfs..cow
查看>>
用dfs实现图中有无环的查询
查看>>
背包问题/HDU串1248
查看>>
阶乘/ZJUT校赛"诚哥爱数学"/
查看>>