Recently, I wrote makefile, Encountered the error nm: test. O: file format not recognized. Let’s see:
test.h:
void output();
test.cpp:
#include <stdio.h>#include "test.h"void output(){ printf("c is good\n");}
compile:
xxxxxx:~/mkfile> g++ -c test.cpp test.h -o test.oxxxxxx:~/mkfile> nm test.onm: test.o: File format not recognizedxxxxxx:~/mkfile>
Strange, isn’t it?The reason is that there are too many test. H files. There is no need at all. The compiler will find them automatically as long as you specify the directory. If you change the order of test. H and test. CPP, you will be prompted:
xxxxxx:~/mkfile> g++ -c test.h test.cpp -o test.og++: cannot specify -o with -c or -S with multiple filesxxxxxx:~/mkfile>
We have already said that.
It seems that when there is – O, you can go to – C to specify multiple files, which is a huge pit.
Let’s share my teacher Dashen’s AI course. Zero base! Easy to understand! Funny! And yellow jokes! Hope you can join our AI team! https://blog.csdn.net/jiangjunshow
Read More:
- Error encountered during QT + opencv compilation: file not recognized: file format not recognized error resolution
- Solution to the problem of GCC file format not recognized
- import org.junit.Test And @ test error reporting — solutions
- [Solved] KEIL Error: source file ‘.XXX.o‘ – object file renamed from ‘XXX.o‘ to …
- When generating a test report in HTML format, report [typeerror: a bytes like object is required, not ‘STR’]
- Visual slam Lesson 6: curve fitting with g2o, error: cmake error at CMakeList.txt (find_ package) By not providing“FindG2O.cmake“
- Error: option — single version externally managed not recognized
- Conversion of audio file format with ffmpeg command
- Python read / write file error valueerror: I/O operation on closed file
- Convert Tencent video QLV format to MP4 format
- XLRDError: Excel xlsx file; Not supported error reporting solutions
- invalid connection string format, a valid format is host:ip:port
- Solution to Apple Wireless Mouse, keyboard or touchpad can not be recognized by MAC
- Library file error: adding symbols file in wrong format
- Error: option –single-version-externally-managed not recognized when python pip installs third-party libraries
- error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file o
- Viewing the file system format of disk partition under Linux
- VIM setting file encoding format
- Solve cannot execute binary file: exec format error under Linux
- Extract audio from ffmpeg video to mp3 format or m4a format command