In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use CPP + to compile CPP files in the Ubuntu environment, with a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
The error of undefined reference was reported when compiling the cpp file with Gmail + for the first time. All the functions in the custom class could not be found. After looking up the data, we found that the called class needed to be linked. This paper uses a small example to describe the compilation process. The class2 class calls the member function of the class1 class, which depends on the class1 class, while the test file calls the member function of the class2 class, which depends on the class1 class.
/ / class1.h#ifndef _ CLASS1_H#define _ CLASS1_Hclass class1 {public: int f (int I);}; # endif//class1.cpp#include#include "class1.h" using namespace std;int class1::f (int I) {if (iMoh1) return 1; else return f (iMuth1) + f (iMuth1);} / / class2.h#ifndef _ CLASS2_H#define _ CLASS2_H#include "class1.h" class class2 {public: int double_f (int I);} # endif//class2.cpp#include#include "class2.h" using namespace std;int class2::double_f (int I) {class1 c; return 2*c.f (I);} / / test.cpp#include#include "class2.h" using namespace std;int main () {class2 c2; cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.