views:

23

answers:

1

I am really new to c++ and am using Netbeans for now.

I managed to create a Sign.h and Sign.cpp containing a working class Sign. I added these to a Console Project and it works great:

  #include <iostream>
  #include <ostream>
  #include "Sign.h"

  int main()
  {
      Sign sign = Sign::parse("b");
      std::cout << sign.toString() << " " << sign.getValue() <<"\n";
  }

However, I want to create a static library containing the Sign class, so I created a static library and added Sign.cpp and Sign.h to it. The problem now is, that I can't seem to get my Sign class to be included in the main console program.

I added the library in Options => Build => Linker => Libraries, and added it to the required projects. However I can't use #include <Sign> or #include <Sign.h>.

What am I missing here?

A: 

You need two files from a library. The library file (.lib on windows, .a on linux) and the include file (.h files).

The Options => Build => Linker => Libraries is only for the library file. You also need to set the path for the includes under File => Project Properties => Build => C++ Compiler => General => Include Directories

Victor Marzo
Great, I got it working!
Peterdk