Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9075829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:57:38+00:00 2026-06-16T18:57:38+00:00

I have a declaration of an inline function that happens to be recursive. Since

  • 0

I have a declaration of an inline function that happens to be recursive. Since it’s recursive there is no point in declaring it inline so why does my linkage fail when i remove it?

3 files:

\\File1.h

#ifndef FILE1_H
#define FILE1_H

inline int Factorial(int a)
{
    if (a < 2)
        return 1;
    return a*Factorial(a-1);
}

int PermutationsNum(int b);


#endif


\\File1.cpp
#include "File1.h"

int PermutationsNum(int b)
{
    return Factorial(b);
}


\\File2.cpp

#include <iostream>
#include "File1.h"

int main()
{
    std::cout << "permutations of 7 elements: " << PermutationsNum(7) << std::endl;
    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T18:57:40+00:00Added an answer on June 16, 2026 at 6:57 pm

    inline tells the compiler not to export the symbol. If you don’t use it, the symbol will be exported by all compilation units that include that file, thus resulting in a multiple definition.

    3.2 One definition rule [basic.def.odr]

    4) Every program shall contain exactly one definition of every non-inline function or variable that is odr-used
    in that program; no diagnostic required. The definition can appear explicitly in the program, it can be found
    in the standard or a user-defined library, or (when appropriate) it is implicitly defined (see 12.1, 12.4 and
    12.8). An inline function shall be defined in every translation unit in which it is odr-used.

    This is the only pertinent use of the keyword inline in fact – actually inlining functions is up to the compiler.IMO, the keyword is even less than a hint in that sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a declaration in a cpp where a function is like: virtual void
i have a static library which (among other things) implements a tiny function that
I find out that Apple uses the following declaration in OSAtomic.h header: inline static
In one header file, i have a inline function define like bellow: extern CMODEXPORT
I would like to have declaration like this: void Date::get_days_name(const Date& = this) which
I have the declaration (or similar) std::map< std::string, Stock*> &stocks; throughout my code. Eclipse
In my head.phtml , I have following declaration for getting a menu work. <script
I have a table declaration: TYPE PERSON_TYPE AS OBJECT (ID NUMBER(38), NAME VARCHAR2(20)); TYPE
I have an enum declaration as: enum qty { cars = 10, bikes =
I have a C code in which I have a structure declaration which has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.