One or more multiply defined symbols found

后端 未结 9 629
夕颜
夕颜 2020-11-30 04:38

DebugUtil.h

#ifndef DEBUG_UTIL_H
#define DEBUG_UTIL_H

#include 

int DebugMessage(const char* message)
{
    const int MAX_CHARS = 1023;
           


        
9条回答
  •  执笔经年
    2020-11-30 05:09

    Make the function inline or declare the function in a header file and define it in a cpp file.

    inline int DebugMessage(const char* message)
    {
        const int MAX_CHARS = 1023;
        static char s_buffer[MAX_CHARS+1];
    
        return 0;
    }
    

    EDIT:

    As a comment by Tomalak Geret'kal suggests, it's better to use my latter suggestions than my former and move the function's declaration to a cpp file.

提交回复
热议问题