Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Inline functions with VC++ 4.2

Posted on 1998-06-18
2
Medium Priority
?
235 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 200 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

604 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