Xcode 3.0 linking error
Xcode 3.0 linking error
- Subject: Xcode 3.0 linking error
- From: Thomas Hauk <email@hidden>
- Date: Thu, 6 Mar 2008 19:29:01 -0800
Given a TestLib (BSD Static Library) which exposes a static function
that takes a vector reference as a parameter:
***TestLib.h
#include <vector>
namespace TestLib
{
class Test
{
public:
static void F(std::vector<int>& v);
};
}
***TestLib.cpp
#include "TestLib.h"
namespace TestLib
{
void Test::F(std::vector<int>& v)
{
v.push_back(1);
}
}
***
And given TestApp (Carbon C++ Application) that includes TestLib.h and
links statically to TestLib.a, building Debug gets the following error:
Undefined symbols:
"TestLib::Test::F(__gnu_debug_def::vector<int, std::allocator<int>
>&)", referenced from:
_main in main.o
ld: symbol(s) not found
However... building in Release, does not get the linking error, and
the following code runs fine:
***
int main(int argc, char* argv[])
{
std::vector<int> v;
TestLib::Test::F(v);
assert(v[0] == 1);
***
Am I doing something wrong?
I distilled this simple example from a codebase I'm porting now from
MSVC 7.1 to OS X 10.5. The code compiles & runs fine on Windows, for
the record.
T
--
Some people, when confronted with a problem, think "I know, I'll use
regular expressions." Now they have two problems.
--Jamie Zawinski, in comp.lang.emacs
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden