C++:多个文件连接以及头文件小tip

C++:多个文件连接以及头文件小tip_第1张图片

Log

#include 
void Log(const char* message)
{
    std::cout<

Math


#include 
void Log(const char* message);


//int Multiply(int a,int b)
//{
//    Log("Multiply");
//    return a*b;
//#include "header/EndBrace.h"
//    //头文件和cpp要在同一层级下
//    //#include "header/EndBrace.h"//将头文件内容粘贴到此处


//展示链接错误问题:若没有main函数,报函数入口点miss,且,先编译再链接,同时有编译错误和链接错误
//会先报编译错误,因为编译层级没过,卡在此处终止,解决后再链接,一个xcode项目中只能有一个main函数入口,因为创建的是一个项目,不是文件包
int Multiply(int a,int b)
{
    Log("Multiply");
    return a*b;
}


int main() {
    // insert code here...
    std::cout << "Hello, World!"<

头文件C++:多个文件连接以及头文件小tip_第2张图片

你可能感兴趣的:(c++,算法,开发语言)