Nuklear icon indicating copy to clipboard operation
Nuklear copied to clipboard

no visual studio project example

Open zooid opened this issue 3 years ago • 2 comments

Hello,

Could you please add a visual studio example project, I cannot figure out how to make Nuklear compile. All I get is errors.

I know this is a rather novice request, however I think having this there will increase popularity even further.

Thanks in advance.

zooid avatar Aug 05 '22 14:08 zooid

Nuklear is not to be compiled separately (as separate object file nor as binary library like DLL, so/ELF, dylib, ...). It is not a "binary" library. It is only to be included (and only and only once in the whole project!) and nothing else. Nuklear is header-only library - see https://en.wikipedia.org/wiki/Header-only .

In other words, having a VS project would not help at all because it is equivalent (in its informative value) to this 2-file project:

main.c

#define mydefine
#include "main.h"
int main( *x, **y ){
  return 0;
}

main.h

#ifdef mydefine
// here comes the code of a header-only library
#endif

dumblob avatar Aug 05 '22 15:08 dumblob

@zooid

You need to put file into your solution/project, add it, compile with it.

Nuklear provided a nice description how you should use it and compile.

It is a novice problem, but not in terms of using library, but with understanding how the programming language works. You should learn it well, because C++ doesn't tolerate people who thinks that they know the language or they have enough knowledge, because they can compile hello world example.

So you need to include header in your headers where nuklear supposed to be used, but you need to define implementation of library without it you can't compile your project.

So you go to main.cpp or any other .cpp file where you think it is nice to have implementation and you write those lines, ONLY IN ONE CPP FILE:

#define NK_IMPLEMENTATION
#include "nuklear.h"

In header files you need to write this:

#include "nuklear.h"

wh1t3lord avatar Aug 19 '22 09:08 wh1t3lord