[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
Edit » VisualCSharpHelloWorldWindowsWpf » Assembler » Calculating and Validating NMEA Checksums » TurboCpp » WhatLinksHere » QbasicFAQ_WhenToUseSubs » CppWchar_t » Martin Richards » Curl Content Language » CppLinkingError
Displaying differences between revision 10 and the latest revision


= (C++) Linking error =

An error found during  ?linking or run-time.

Mostly, this means that in the header files, you've give the declaration of a function, but nowhere given the function body.

The code below has the function definition commented out, resulting in a linking error.

[code]
#include <iostream>

//Declaration of doSomething();
void doSomething();

int main()
{
doSomething();
return 0;
}

//Definition of the function
//Removing this part returns in a linking error
/* //Commented this function out to generate a linker error.
void doSomething()
{
std::cout << "Hello world" << std::endl;
}
*/
[/code]

In C++ Builder the error message will be:
[code]
[Linker Error] Unresolved external 'doSomething()'
referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\UNIT1.OBJ
[/code]

== Other errors ==
* C++ compile errors
* C++ linking errors
* C++ runtime errors
* [[CppBuilderC compileE errors | C++ Builder compile errors ]] s
* C++ Builder linking errors
* C++ Builder run-time errors
* C++ Builder misc errors

== Topic links ==
* [blue]::[/blue], scope operator
* [blue]<<[/blue], stream out operator
* #include
* const
* cout
* endl
* #include
* iostream
* main
* return
* scope operator, [blue]::[/blue]
* std
* stream out operator, [blue]<<[/blue]
* vector





last edited (July 3, 2007) by bilderbikkel, Number of views: 22077, Current Rev: 11 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Site Management by Lars Hagelin at Kontantkort.se.