Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am just getting used C++ syntax and have constructed a very simple bit of code for testing:

I have the following files:

shoe.h (contains declaration for "TieLaces")
test.cpp (contains "main")
shoe.cpp (contains a function "TieLaces" which I make use of in "test.cpp")

Test.cpp and shoe.cpp are part of the same assembly (i.e., shoe.cpp is not part of an external library).

I am using MS VC++ 2008. It compiles fine, but the Linker section reports an "unresolved token" with regard to function "TieLaces".

I know that external libraries must be referenced in the Linker config section for external libs, but there is no way to reference an internal function (that I know of). So, why is this error occurring?

#include "stdafx.h"
#include "Shoe.h"

#define TRUE 1;
#define FALSE 0;

Shoe::Shoe() {}
Shoe::~Shoe() {}

bool TieLaces(void)
	bool Done = TRUE;
	return Done;

#include "stdafx.h"
#include "Shoe.h"

using namespace System;

int main(array<System::String ^> ^args)
    Console::WriteLine(L"Hello World");
    Shoe newShoes;
    return 0;

class Shoe
	bool TieLaces(void);

1 solution

You have defined TieLaces as a member of the Shoe class in Shoe.h.
But in Shoe.cpp you have defined TieLaces as a global function.
Change it to -
bool Shoe::TieLaces(void)
	bool Done = TRUE;
	return Done;
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900