Solved

Inline functions with VC++ 4.2

Posted on 1998-06-18
2
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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…

732 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