Linker Error
-
Hello there
I made a sample C++ Win32 console application and then added a class CFileParser.
Now i add a function inside the CFileParser called OpeningInstructions() which is declared as public.
Now i include FileParser.h in the main file of the app having MAIN() function and then trying to call the function.............. and it gives an error as shown below.
Fro some reason it's not able to detect the function inside the clas CFileParser.
Any idea how to resolve this?
Thanks in advance
<pre lang="vb">error LNK2019: unresolved external symbol "public: void __thiscall CFileParser::OpeningInstructions(void)" (?OpeningInstructions@CFileParser@@QAEXXZ) referenced in function _wmain
1>C:\SourceCode\CodeFileParser\CodeFileParser\Debug\CodeFileParser.exe : fatal error LNK1120: 1 unresolved externals</pre></pre> -
Hello there
I made a sample C++ Win32 console application and then added a class CFileParser.
Now i add a function inside the CFileParser called OpeningInstructions() which is declared as public.
Now i include FileParser.h in the main file of the app having MAIN() function and then trying to call the function.............. and it gives an error as shown below.
Fro some reason it's not able to detect the function inside the clas CFileParser.
Any idea how to resolve this?
Thanks in advance
<pre lang="vb">error LNK2019: unresolved external symbol "public: void __thiscall CFileParser::OpeningInstructions(void)" (?OpeningInstructions@CFileParser@@QAEXXZ) referenced in function _wmain
1>C:\SourceCode\CodeFileParser\CodeFileParser\Debug\CodeFileParser.exe : fatal error LNK1120: 1 unresolved externals</pre></pre>Let's see the code for the
CFileParser
definitions, and also the place where you call it in your main program. Are you sure you added the full implementation into your project? Or, if theCFileParser
class is created as an external library, did you include that in your linker preferences?One of these days I'm going to think of a really clever signature.
-
Hello there
I made a sample C++ Win32 console application and then added a class CFileParser.
Now i add a function inside the CFileParser called OpeningInstructions() which is declared as public.
Now i include FileParser.h in the main file of the app having MAIN() function and then trying to call the function.............. and it gives an error as shown below.
Fro some reason it's not able to detect the function inside the clas CFileParser.
Any idea how to resolve this?
Thanks in advance
<pre lang="vb">error LNK2019: unresolved external symbol "public: void __thiscall CFileParser::OpeningInstructions(void)" (?OpeningInstructions@CFileParser@@QAEXXZ) referenced in function _wmain
1>C:\SourceCode\CodeFileParser\CodeFileParser\Debug\CodeFileParser.exe : fatal error LNK1120: 1 unresolved externals</pre></pre>You need to add a cpp file or a lib file to your project depending on what you've got. If you have FileParser.cpp file (most likely this is the case) do the following: In the Solution Explorer right click on the project and Select Add->Existing Item. Locate your FileParser.cpp and select it. If you are given a lib file together with the FileParser.h you need to add it via the Project properties. In the Solution Explorer right click on your project and select Properties. Go to Linker options -> Input. In the Additional dependencies field type the name of your lib file, e.g. FileParser.lib.