r3 - 18 Apr 2008 - 15:27:20 - RickMachYou are here: TWiki >  Documentation Web  >  AskedQuestions > GPSTkWindowsStaticLib

Question

I built a static library from the GPSTk source (following the directions under "BuildingGPSTkUnderWindows") using MS Visual C++ 2005 Express Edition.

Now, I want to include that library in another project which also includes sockets. The problem is that Daytime.hpp redefines struct timeval, which causes a compile error. Again, the library compiles fine under VC++ 2005 Express Edition. The problem occurs when I add the resulting library to another project.

How can this be fixed?

-- AmyV - 03 Apr 2008

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

I'm going to discuss the reason DayTime defined the structure. with some of the developers. There is a comment in the code that says "timeval is defined in winsock.h, which we don't want to include because it breaks lots of this code". I'm not sure if it breaks stuff in the header or just in the .cpp file. Thus, the fix might be just adding a ifndef around the timeval definition in DayTime.hpp like:

#ifndef timeval
struct timeval {
  long    tv_sec;         /* seconds */
  long    tv_usec;        /* and microseconds */
};
#endif
Of course this may break the code due to the comment but that is what I'm going to discuss and get back with you on.

-- RickMach - 04 Apr 2008

Well in doing a test with the current version of the compiler, putting an include of winsock/winsock2.h instead of defining it breaks lots of the GPSTk code. Did putting the ifndef work ok for you?

-- RickMach - 18 Apr 2008

 
Change status to:

SupportForm
SupportStatus AskedQuestions
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
 
WEBLOGOALT
This site is powered by the TWiki collaboration platformCopyright amp;© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback