I'm working on an overdue lab for my computer science class at home. At school we program in a basic text editor and compile in Ubuntu's terminal window. Here, I'm using Windows 7 and Netbeans 7.0. Here's my problem: The professor supplied us with the file lab6tester.o which, when used to build an executable, produces a program that allows us to test our code. It would compile using the following command:
g++ lab6.cpp lab6tester.o -o lab6
But I'm not in terminal, and I'm frankly no good with the windows command prompt (all the linux users just gave a fist-pump), so I can't compile this way. I loaded lab6.h into the header files section of a NetBeans project and lab6.cpp and lab6tester.o into the source files section, got rid of the NetBeans-supplied main.cpp file, and then tried to build. Didn't work. What am I doing wrong, and how can I fix it??
First, do you understand to use Mingw instead of GCC in Win32? http://www.mingw.org/
I would avoid using cl.
Second I'm raging a little that your teacher would give you an object file to test against instead of a shell or something like that. What is the environment that this sets up exactly? Would Cygwin be a better solution? http://www.cygwin.com/
The simplest thing to do here would be for us to walk you through the Windows Command prompt.
- First you open the Command Console by typing "CMD" into the search box on the start bar.
- you'll need to have the compiler in the same directory as your working files unless you've already added them to the global path.
Compiling is no different on Windows.
Change to the bin directory of your MinGW installation (or add it to your PATH variable) and invoke g++ as usual.
However, if the object file was compiled for Linux, you can't use MinGW to link it into a Windows executable.
Edit: although I suppose it might be possible with Cygwin.
But just setting up Ubuntu in a VM is probably the easier solution.
However, if the object file was compiled for Linux, you can't use MinGW to link it into a Windows executable.
This is where Cygwin comes in Ninja'd by Athar's edit. But unless you're at least in your fourth year on your way to your Masters then it means your proffessor is an ass.
I just thought about it, why not download a live disk and compile everything there? http://www.ubuntu.com/download
This would probably be the quickest solution and it would give you time to step away from the project and collect your thoughts.
Hey. Sorry I forgot to include that I am in fact using cygwin as my netbeans compiler.
Yes, the object file was compiled for Linux, but then we were supposed to be working on the lab from the linux pc's at college. It's honestly my own fault for not having the lab done on time. He's giving me some grace and letting me hand it in late, even though the semester is over. So, no, not a total ass. But I've run into this problem, which I don't think he anticipated.
The vmware solution would indeed work fine, but I'd like to avoid it, simply because I'm at home and my parents, in their computer illiteracy, have already begun to get on my case about "downloading too many things onto the computer" (i.e. cygwin and netbeans with the c++ package). Is there a way that I can take care of it just using cygwin? I know that it includes the g++ compiler. But if this is going to be very difficult to explain to me then honestly don't worry about it much. I can try vmware, or really i can just take the zero on the lab that I deserve. :P