0

I want to include header files in my library project in OpenSSL's way. But I can't make it work.

Suppose my library project looks like this:

C:\MYLIB
├─ A
│  ├─A.h
│  └─A.c
├─ B
│  ├─B.h
│  └─B.c
├─ C
│  ├─C.h
│  └─C.c
└─ include
   └─mylib
       ├─A.h
       ├─B.h
       └─C.h

Now I have a new project which includes the header files in mylib. I have added C:\MYLIB\include to the additional include directories. The include statement in my new project are:

#include <mylib\a.h>
#include <mylib\b.h>

where mylib\a.h contains only one line to direct to the real A\A.h:

../../A/A.h

and mylib\b.h contains:

../../B.B.h

Just like the OpenSSL's way. However, my VS2010 is complaining "error C2059: syntax error:'.', while the error leads to first '.' in mylib\a.h.

Does these include make sense? How should I include those header files from mylib correctly?

jww
  • 97,681
  • 90
  • 411
  • 885
Chiara Hsieh
  • 3,273
  • 23
  • 32
  • I believe you need the leading dot to avoid the error you are experiencing. Try `.\..\..\A\A.h`. Also, OpenSSL flattens itself out to `include\mylib` on install. It does not use it during build. During build, the various paths are included with `-I` options. – jww May 06 '14 at 11:44
  • I fixed the title of your question to match the actual problem you are facing. – alk May 06 '14 at 12:18
  • Thanks for the reply. I tried the leading dot, and it still doesn't work. I found this SO post http://stackoverflow.com/questions/8123667/how-to-include-oppenssl-headers, it says "I'm guessing you're attempting to build on Windows, because the tarfile on a Linux or Unix machine should have fixed up all those symlinks." Would that be the problem? Than I'm building it on Windows? – Chiara Hsieh May 07 '14 at 02:22

1 Answers1

0

This

#include <mylib\a.h>
#include <mylib\b.h>

looks wrong (or to be precise: it hurts my eyes .. ;-)

You might like to use a slash:

#include <mylib/a.h>
#include <mylib/b.h>
alk
  • 69,737
  • 10
  • 105
  • 255