Thread: Visual C++ 6 Problem

  1. #1
    Registered User samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Newport
    Posts
    382

    Visual C++ 6 Problem

    Yes, it's me again with another strange problem.

    After switching from the Debug to Release configuration, my build started throwing up an error (it always built under Debug) - an unresolved external symbol (a function, in this case).

    After some detective work, I whittled down the cause to an optimisation - regarding inline functions.

    The offending function was indeed an inline one, and making it out-of-line removed the problem.

    But why should this error occur in the first place? Why the trouble with inline functions?

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I seem to remember reading on these forums before something about inline functions, visual c++ 6.0 and a the latest patch being needed. Just in case, you have the latest patch?

    You may also avoid the error without changing your code if you change your optimization settings for inline functions. If the code is meant to be compiled on other compilers and you are sure of the advantages of keeping the function inline, this may be your best option.

    However, I don't know why you are getting this error.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    is your inline function body located in the header?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Registered User samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Newport
    Posts
    382
    Quote Originally Posted by vart
    is your inline function body located in the header?
    No. Should it be?

    I thought you just followed the same conventions as an out-of-line one...

  5. #5
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    No it shouldn't. Vart was just asking in case it was. Headers should only include function prototypes and definitions, not their implementations.
    Double Helix STL

  6. #6
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by swgh
    No it shouldn't. Vart was just asking in case it was. Headers should only include function prototypes and definitions, not their implementations.
    Some compilers cannot find inline functions, if the body is not present in the header file
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visual studio.net C++ Problem
    By Dina in forum C Programming
    Replies: 5
    Last Post: 07-19-2008, 02:34 PM
  2. Visual C++ Tool Problem
    By wolfban in forum Tech Board
    Replies: 2
    Last Post: 07-23-2005, 07:41 PM
  3. errors in my class....
    By o0obruceleeo0o in forum C++ Programming
    Replies: 9
    Last Post: 04-14-2003, 03:22 AM
  4. Visual Basic Adodc Problem
    By rahat in forum Windows Programming
    Replies: 1
    Last Post: 01-20-2002, 06:55 AM
  5. Microsoft Visual C++ compiler, cast problem?
    By jonnie75 in forum C Programming
    Replies: 5
    Last Post: 11-10-2001, 08:53 AM