Solved

Inline functions with VC++ 4.2

Posted on 1998-06-18
2
230 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

856 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