Hi. I made some headers I want to include in every project from the include directories. So I'll be able to do #include <hello.h> instead of "hello.h", and I won't need to place them in the same directory every time.

So I did this:

[IMG]http://i38.tinypic.com/2n1bdj8.jpg[/IMG]
[IMG]http://i34.tinypic.com/33a4d1g.jpg[/IMG]

but it doesn't work. I don't a get any compile errors; I get link error:

#include <iostream>

#include <palindrome.h>

using namespace std;

int main()
{
	int j = palindrome(53);
	return 0;
}

1>main.obj : error LNK2019: unresolved external symbol "int __cdecl palindrome(int)" (?palindrome@@YAHH@Z) referenced in function _main
1>C:\Users\User\Documents\Visual Studio 2008\Projects\Palindrome\Debug\Palindrome.exe : fatal error LNK1120: 1 unresolved externals

Recommended Answers

All 6 Replies

Try this..

// ... palindrome.h
static void palindrome(int i_var)
{
    // your code
}
// ...

hi minas1 !
Have you implemented the function 'palindrome' in a c/c++ file?

Yep :)

#include <palindrome.h>

int get_power(int num)
{
	int power = 1;
	while(num != 0)
	{
		num /= 10;
		power *= 10;
	}
	power /= 10;
	return power;
}

int palindrome(int num)
{
	int the_palindrome = 0,
		power = get_power(num),
		temp = power;
	
	for(int i = 1; i <= power; i *= 10, temp /= 10)
		the_palindrome += num / i % 10 * temp;

	return the_palindrome;
}

bool is_palindrome(int num)
{
	return num == palindrome(num);
}

Add your lib. path as additional include directory..

Add your lib. path as additional include directory..

I don't have one..

Yes you have..On compiler properties/settings page..Sorry for my bad English..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.