OpenNurbs: Linking for Dummies, plus doing it for an Unreal Project

To start I want to say I’m not that great at static linking, dynamic linking, SDK, all the different settings visual studio has. I’m a game programmer who mostly works with game engines and I almost never have to link any SDK to projects.

I tried to follow these steps to the best of my ability.
Step 1: was easy :slight_smile: .
Then with step 2, I used visual studio community 2019 (I couldn’t get 2017 to get to work because of missing plugins that I couldn’t find). I selected Release as my configuration and as the platform I selected x64.
At step 3: I opened up an Unreal Project that I wanted to test OpenNurbs with. For anyone who is not familiar with Unreal. It is a C++ game engine.

Then with step 4 I had and still have a lot of trouble. At first when I read “In your project’s stdafx.h” I thought okay this file is a file that is in every C++ project so I need to search in my Unreal Project. That was not the case and a friend explained to me I just needed to use the sdtafx.h file in the OpenNurbs folders. Then I put those lines in that file with the right path and in my Unreal projects .h file I put this include line: #include "D:\Downloads\opennurbs-7.x\opennurbs-7.x\freetype263\stdafx.h" and I also went to the project properties -> VC++ Directories -> Include Directories and added D:\Downloads\opennurbs-7.x\opennurbs-7.x .

I now get the link error: LNK1104 cannot open file 'D:/Downloads/opennurbs-7.x/opennurbs-7.x/bin/x64/Release/freetype263.lib'

And indeed there is no freetype263.lib file at that location. Did I mess up at step 2 or I’m doing something else wrong?

Sorry if this is something very obvious, but I can’t figure it out :frowning:

You kinda already asked here: OpenNURBS with Unreal

But the stdafx.h file is one that you create in your project. Do not reference stdafx.h header files from other projects.

So, in your project create the file named stdafx.h. Add the lines from step 4 replacing <MY_NISTALLPATH> as instructed.

Yeah I wasn’t entirely sure if it was better to ask more questions there or start a new topic because that was topic was mostly about the stdafx.h file and with this topic I want to ask questions about each step.

But okay, I will try to create my own stdafx.h file as instructed. Does the .h file need anything more than was instructed?

(PS what does the name stdafx.h stand for? I’m curious. My guess right now is StandardAwesomeFileX but that might be wrong :wink: )

I asked the internet for you: What is "stdafx.h" used for in Visual Studio? - Stack Overflow

I see the name is historical and no one knows what the name means :confused: . Bummer.

I did what you asked me and created a stdafx.h file in my project. And added the lines. I get the same freetype263.lib error when I put the slashes as this

And when I put the slashes like this , I get these errors

So I’m still doing something wrong. When you said create a stdafx.h file, does that mean I need to do more than just create a class and put the lines in the file? I found this video: Modern C++ PRECOMPILED HEADERS - Easy and In-depth explanation with clear examples! - YouTube

But in my Unreal project I can’t select any C++ settings. My properties menu looks just like this:

And yes this is not visual studio 2019 anymore but in this IDE I have the same settings and the compiling goes faster

When using backward slashes \ you’ll need to use double backward slash, otherwise the compiler will interpret backslash and next character as espace sequence character (like newline \n).

Did you build OpenNURBS without errors?

@dale are you able to help here?

Yes I believe so. The last time I checked I didn’t get any error that made the build fail. Maybe I missed a warning though. No idea :frowning: