Solved

Inline functions with VC++ 4.2

Posted on 1998-06-18
2
226 Views
Last Modified: 2010-04-01
Hi,

I would like to know how to get inline functions to work in VC++.

My header file contains...
int MyFunc( DWORD X );

The CPP source looks like this...
inline int MyFunc( DWORD X )
{
   return X * X;                      
}

Now other CPP files have include the header file with MyFunc decalartion. All the files and header files are part if the project.

When I compile, the compile succeeds, but a link error
Undefined external int __fastcall MyFunc....
is reported.

I am compiling with Maximise Speed, Pentium, __fastcall
settings.

Any suggestions as to how I can get inline functions working?

Thankx in advance,
Mark
0
Comment
Question by:mark_21
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1166232
Yes, you need to have

inline int MyFunc( DWORD X )
{
   return X * X;                      
}

In your header file, NOT your source file.

0
 

Author Comment

by:mark_21
ID: 1166233
Thankx, that works great!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now