Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans Project from Mac to Windows

I created a Netbeans CPP Project in my Mac and uploaded it into git. The project has collaborators who use Windows.

When I pushed my project into github , I pushed the makefile information too (the whole project). Now the collaborators are getting build errors because the reference contains my Mac filepaths.

The Windows machine have cygwin installed.

  1. How do I resolve it ?
  2. How I do make it platform independent ?
  3. What should I (and collaborators ) do to not affect the other workers ?

ANSWER : Netbeans has an option (in the project properties under c++), to have the file path as absolute or relative. So I all had to do was, set the relative option and push the changes . The project started working for everyone ! VOILA !!!!!!!!

like image 587
bsoundra Avatar asked Oct 25 '11 23:10

bsoundra


2 Answers

Netbeans has an option (in the project properties under c++), to have the file path as absolute or relative. So I all had to do was, set the relative option and push the changes . The project started working for everyone ! VOILA !!!!!!!!

like image 81
bsoundra Avatar answered Sep 21 '22 21:09

bsoundra


I've found that the project files generated by NetBeans for C++ are rather unweildy and aren't very maintainable by humans. And while they do tend to reference paths relatively from the root of the project (facilititating copying the project to different directories), there's just too many project files to maintain. And you're sol if they don't work.

I don't know if NetBeans allows you to specify environment variables for paths in the project settings dialogs. The macro/variable stuff is largely undocumented as far as I can tell. But if you know how to do that, then define all your file path dependencies by an environment variable instead of a hardcoded path in the project settings window. Remote developers need only redefine the environment vars on their machine.

But I think a better solution is to not use the NetBeans auto-generated Makefile from Project Settings. Instead, declare your own Makefile and create a NetBeans project type from "an existing Makefile". I've found that works really well.

Then you can have a line at the top of you Makefile as follows:

include common.inc

Where "common.inc" includes all the hardcoded library paths that are machine dependent. Here's an example of mine:

BOOST_INCLUDE := -I/home/jselbie/lib/boost_1_46_1
OPENSSL_INCLUDE := -I/home/jselbie/lib/openssl

And then my Makefile only references these directories by variable name. And so when I move the project around different machines with different configs, I just need to update common.inc.

And then if anyone else wants to use NetBeans to compile my project, they just need to create a NetBeans project from "an existing Makefile" option.

like image 28
selbie Avatar answered Sep 22 '22 21:09

selbie