当前位置:网站首页>GCC [7] - compilation checks the declaration of functions, and link checks the definition bugs of functions
GCC [7] - compilation checks the declaration of functions, and link checks the definition bugs of functions
2022-07-06 19:09:00 【Small snails in big cities】
Project scenario :
- I have a problem recently , Let's simplify :
// int xxx();
int main()
{
xxx();
}
- Compile the , Natural compilation, but , The message is :
[email protected]:~/taoge/cpp/test$ g++ -c main.cpp
main.cpp: In function ‘int main()’:
main.cpp:5:9: error: ‘xxx’ was not declared in this scope
xxx();
^
[email protected]:~/taoge/cpp/test$
- Open the above comment , obtain :
int xxx();
int main()
{
xxx();
}
- Compile the , Can you pass ? have a look :
[email protected]:~/taoge/cpp/test$ g++ -c main.cpp
[email protected]:~/taoge/cpp/test$
- Link up , Find out xxx() Undefined .
[email protected]:~/taoge/cpp/test$ g++ main.o
main.o: In function `main': main.cpp:(.text+0x5): undefined reference to `xxx()'
collect2: error: ld returned 1 exit status
So as to confirm the problems in the title .
My wonder at that time was , xxx Function has no definition , Can actually compile . It does . To distinguish between compilation and linking .
Take a closer look at the above English Tips , Compile not pass , It is shown that not declared, And the link doesn't pass , It is shown that undefined. therefore , At a glance .
边栏推荐
- Wx applet learning notes day01
- 如何提高网站权重
- Summary of performance knowledge points
- Binary search tree
- Openmv4 learning notes 1 --- one click download, background knowledge of image processing, lab brightness contrast
- Airiot IOT platform enables the container industry to build [welding station information monitoring system]
- Sanmian ant financial successfully got the offer, and has experience in Android development agency recruitment and interview
- Take a look at how cabloyjs workflow engine implements activiti boundary events
- RedisSystemException:WRONGTYPE Operation against a key holding the wrong kind of value
- [depth first search] Ji suanke: Square
猜你喜欢

Pychrm Community Edition calls matplotlib pyplot. Solution of imshow() function image not popping up

ROS自定义消息发布订阅示例

Actf 2022 came to a successful conclusion, and 0ops team won the second consecutive championship!!
![[depth first search] Ji suanke: Square](/img/fc/e42ae0d036be258bed5623d55fc2db.jpg)
[depth first search] Ji suanke: Square

MRO工业品企业采购系统:如何精细化采购协同管理?想要升级的工业品企业必看!

深度循环网络长期血压预测【翻译】

LeetCode-1279. 红绿灯路口

Unlock 2 live broadcast themes in advance! Today, I will teach you how to complete software package integration Issues 29-30

能源行业的数字化“新”运维

Openmv4 learning notes 1 --- one click download, background knowledge of image processing, lab brightness contrast
随机推荐
The nearest library of Qinglong panel
Optical blood pressure estimation based on PPG and FFT neural network [translation]
Master Xuan joined hands with sunflower to remotely control enabling cloud rendering and GPU computing services
Synchronous development of business and application: strategic suggestions for application modernization
业务与应用同步发展:应用现代化的策略建议
R language ggplot2 visualization: use ggviolin function of ggpubr package to visualize violin diagram
驼峰式与下划线命名规则(Camel case With hungarian notation)
Airiot IOT platform enables the container industry to build [welding station information monitoring system]
第五期个人能力认证考核通过名单公布
Tongyu Xincai rushes to Shenzhen Stock Exchange: the annual revenue is 947million Zhang Chi and Su Shiguo are the actual controllers
根据PPG估算血压利用频谱谱-时间深度神经网络【翻】
ACTF 2022圆满落幕,0ops战队二连冠!!
2022.2.12
Deep circulation network long-term blood pressure prediction [translation]
RedisSystemException:WRONGTYPE Operation against a key holding the wrong kind of value
助力安全人才专业素养提升 | 个人能力认证考核第一阶段圆满结束!
Benefit a lot, Android interview questions
提前解锁 2 大直播主题!今天手把手教你如何完成软件包集成?|第 29-30 期
Nuc11 cheetah Canyon setting U disk startup
AUTOCAD——中心线绘制、CAD默认线宽是多少?可以修改吗?