I got OpenNURBS source code(version 6.x) from github and compiled it by visual studio successfully.
Then I tried to write a simple program to generate a 3dm file as example_write.cpp in source code did.
It failed with error LNK2001 unresolved external symbol “public: static class ON_Color const ON_Color::UnsetColor” (?UnsetColor@ON_Color@@2V1@B)
and other linking errors
I had added opennurbs_public.lib into Project → Properties → Linker → Input → Additional Dependencies
Can anyone help me?
The code is following:
#include <opennurbs_public.h>
int main()
{
const wchar_t* filename;
filename = L"curve.3dm";
ONX_Model model;
model.AddDefaultLayer(L"Default layer", ON_Color::UnsetColor);
const int curve_layer = model.AddLayer(L"curve", ON_Color::Gray230);
ON_NurbsCurve* curve = new ON_NurbsCurve(3, false, 4, 4);
curve->SetCV(0, ON_3dPoint(-10, 0, 0));
curve->SetCV(0, ON_3dPoint(-6, 8, 0));
curve->SetCV(0, ON_3dPoint(8, 6, 0));
curve->SetCV(0, ON_3dPoint(10, 0, 0));
curve->SetKnot(0, 0.0);
curve->SetKnot(1, 0.0);
curve->SetKnot(2, 0.0);
curve->SetKnot(3, 1.0);
curve->SetKnot(4, 2.0);
curve->SetKnot(5, 3.0);
curve->SetKnot(6, 3.0);
curve->SetKnot(7, 3.0);
ON_3dmObjectAttributes* attributes = new ON_3dmObjectAttributes();
attributes->m_layer_index = curve_layer;
attributes->m_name = L"my curve";
model.AddManagedModelGeometryComponent(curve, attributes);
model.Write(filename);
return 0;
}