I had 2 assignment that were due tonight and I completed both of them in Visual Studio, but we're required to make sure they compile in linux before submitting them.

I'm getting undefined reference errors when trying to compile Assignment3.

Assignment2 consisted of marble.h and marble.cpp, runs fine.

Assignment3 #included marble.h (NOT marble.cpp) and other new files. When I tried to run Assignment3 the first time in VS2008, it couldn't find the functions that I had written in marble.cpp, so I got marble.cpp and dragged it to my Solution window in Visual Studio. Marble.cpp was now in the list of files that were in my .sln(solution) file.


Assignment3 works fine after that in Visual Studio, but when I moved all the files to my universities linux server and tried to compile, it gave me a ton of undefined reference errors.

How can I fix the unix errors? I think it's the same problem VS2008 gave me before I moved the marble.cpp to the solution. But I'm that much of a linux guy, I don't know what linux's equal is to the .sln file.

On windows, I pressed F5 to debug.
On Linux, I type g++ vector_jar_test.cpp to compile.

Here are my zipped Assignment3 files that works fine in VS2008:
http://www.crewxp.com/Ass3.zip

Recommended Answers

All 3 Replies

you need to compile your other .cpp's into .o's first... so something like g++ -c marble.cpp -o marble.o then you should be able to add it into your compile line I guess like g++ vector_jar_test.cpp marble.o . Should create an a.out for you.

I'm not much on linux either, but I think you can combine all that into one statement: g++ vector_jar_test.cpp marble.cpp will create the executable file a.out.

worked awesome. thanks a lot! I had an extra cpp file called vector_jar.cpp, so I just added that to the command line too using the method u guys used and it worked!

thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.