Any advice on the best way to organize a cross platform library for VS2008

Ok I am writing a library that will be shard between unix and windows. I work with unix all day so the layout of the code is no problem. It is how I present this to a windows guys using VS2008.

Its been a really long time since I did windows dev (cough 3.1) so way out of touch.

I noticed VS2008 creates lots of directories and sub-directories (all of which seem undeeded).

Ok so onto the real question - I think cmake seems a nice easy portable solution - but what about instructions for the windows guys to include the library.

Unix guys know by command line how to add a library - but when you add an IDE it all gets (overly) complicated to me

So the meat of the question is how to provide/layout dir struct for a shared unix/windows library from the point of view of a die hard unix guy

-------------Problems Reply------------

The IDEs are frustrating as hell to use, but it is "expected" of you. :) I find that I just create a "win32/" directory, in which the VC++ project files and directories go, in whatever manner the IDE wants to put them. In the project, I add the files in src/, the same as Unix. At least the IDE will refer to them with relative paths, so it tends to work out.

As for the code itself, using #if HAVE_UNISTD_H around #include <unistd.h> etc, has been very helpful, and in the Windows compile, I tend do have one "win32.h" file that does the porting need.

It gets a little ugly in win32.h, with the preprocessor calls for "strcase* -> stri*" and win32 versions of opendir etc. But I prefer that myself, as I personally do not want the bulk of the code be littered with #ifdef WIN32. I only boot Windows to compile, not to dev.

I will say that I did the Win32 IDE work with the idea that people could compile my apps themselves. This has never happened, and they ask me to compile newer versions. Which is the opposite to Unix world.

Category:windows Views:1 Time:2011-12-17

Related post

  • Organize cross-platform C/C++ project 2011-09-06

    What is the usual/recommended way how to organize a multi-platform (Windows, Linux) C/C++ library project? How to name function and provide OS-dependent implementations, organize includes etc.? Please, constructive ideas only -- no pointers as "Look

  • Advice on cross-platform OpenGL image loader for textures 2010-08-01

    I need to load PNGs and JPGs to textures. I also need to save textures to PNGs. When an image exceeds GL_MAX_TEXTURE_SIZE I need to split the image into separate textures. I want to do this with C++. What could I do? Thank you. --------------Solution

  • Advice needed for 3D objects using the Lightweight Java Game Library (LWJGL) 2011-10-30

    I have spent about 2 Days trying to find out how to make 3d objects using lwjgl, and have found nothing. I can easily render 2d objects, and when I tried to render 3d objects, either the program crashed, or a black screen was opened, right now, I'm u

  • Is PhysicsFS platform-independent? 2011-04-16

    I'm thinking about using PhysicsFS in my game engine project, but I'd like to first make sure it's entirely platform-independent. That's because I'd like to port my engine to some rather obscure platforms after I'm done with the Windows code (Wii Hom

  • Advice for C++ GUI programming 2009-05-17

    I have been writing C++ Console/CMD-line applications for about a year now and would like to get into windows GUI apps. For those of you who have taken this road before, what advice/tips can you give me. Ex: good readings, tutorials, approach tactics

  • Create a small 'window-form' application that runs anywhere 2008-09-22

    I work in the embedded world, using mainly C and no GUI at all (because there is no display screen). Moving over to the non-embedded world, in which I have nearly no experience, what is the best programming environment (langauge/IDE/etc) for me to bu

  • long long alignment problem (MSVC vs. GCC) 2009-03-04

    I'm writing C cross-platform library but eventually I've got error in my unittests, but only on Windows machines. I've tracked the problem and found it's related to alignment of structures (I'm using arrays of structures to hold data for multiple sim

  • What are the pitfalls and gotchas of mixing Objective-C and C? 2009-04-03

    At the risk of oversimplifying something I'm worried might be ridiculously complex, what should I be aware of when mixing C and Objective-C? Edit: Just to clarify, I've never worked with C before, and I'm learning Objective-C through Cocoa. Also I'm

  • Platform C Preprocessor Definitions 2009-07-13

    I'm writing a small library in C++ that I need to be able to build on quite a few different platforms, including iPhone, Windows, Linux, Mac and Symbian S60. I've written most of the code so that it is platform-agnostic but there are some portions th

  • Adding support of Windows to POSIX project- How painful? Is it worth the effort? 2009-08-06

    I'm trying/thinking of making CppCMS - C++ Web Framework project little bit more cross platform. Today I can easily support Linux, OpenSolaris, FreeBSD and even Cygwin. But when it comes to Native Windows it becomes really painful: The overview of th

  • C vs C++ (Objective-C vs Objective-C++) for iPhone 2009-11-14

    I would like to create a portable library for iPhone, that also could be used for other platforms. My question is the fallowing: Does anyone knows what is the best to be used on the iPhone: Objective-C or Objective-C++? Does it works with C++ the sam

  • Direct screen pixel/framebuffer access 2009-12-19

    I'd like to try and create a program playing a game. I.e. "a bot". I want to be able to directly access the pixels on the screen. I.e. have my program "see" a game and then "make a move"(or at least draw a picture of what move it would make). Both Wi

  • Where to begin with multi-threaded programming with c++? 2010-06-15

    I'm trying to implement my own IRC client as a personal proejct and I realized I needed a way to read and write from the socket at the same time. I realized I could have a reading thread which reads from the socket in the background and puts data in

  • How to go about porting a Mac OSX game to Linux 2011-03-08

    Any expert advice on how a beginner to porting might go about starting a project like this? Any porting guides or resources that might be helpful? Commonly used tactics? My idea is to help make a game cross-platform compatible, but I don't know how t

  • How to get started with making a game like Angry Birds on Chrome 2011-05-11

    http://chrome.angrybirds.com/ The browser based app is said to be done using Canvas 2D or Web GL. I tried to view source using chrome by using "Inspect Element" button, but my chrome crashes each time. I am just trying to find out how one can begin t

  • should I eliminate TCHAR from Windows code? 2011-06-11

    I am revising some very old (10 years) C code. The code compiles on Unix/Mac with GCC and cross-compiles for Windows with MinGW. Currently there are TCHAR strings throughout. I'd like to get rid of the TCHAR and use a C++ string instead. Is it still

  • Compiling Visual C++ code in linux 2011-06-14

    I have written a code in visual c++ , which is a sort of GUI used in virtual com PORT connection. However , i need to run that code in linux so that i can make it an open source. Since , visual c++ doesn't work in linux, I need to find out some alter

  • Visual Studio 2010 C++ console applications 2011-06-14

    I am new to C++ and I would like to know what the limitations are in graphics for a console application. For example---Could I create something as compicated as some of the very colorful screensavers that have all kinds of splashes of color?? Could I

  • Cross Platform Tray App 2011-10-07

    I'm looking to develop a type of system tray/dock application that will run in the background and perform some tasks. I want to target Windows and OSX. After doing some research and based on my own skillset, I'm going to go with C++. It will monitor

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.108 (s). 11 q(s)