![]() |
| | #1 |
| Registered User Join Date: Aug 2006
Posts: 159
| first program in *nix Everything below this is the original question. Hi all. Up until this point I've always written and compiled my programs in Windows. I got a Macbook Pro a couple of months ago, and figure it's time to start programming in Unix. I'm not very advanced in terminal, so it took me a bit of time to try to even get to the proper directory. I finally got the commands correct to compile but I got errors on everything, including a hello world program! Every time I try to compile something I get this: Code: /usr/bin/ld: Undefined symbols: for Code: #include <iostream>
using namespace std;
int main( int argc, char *argv[] )
{
cout << "Hello World" << endl;
return 0;
}
Code: current directory$ gcc -o helloworld helloworld.cpp /usr/bin/ld: Undefined symbols: std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&)) std::ios_base::Init::Init() std::ios_base::Init::~Init() std::cout std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&) std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) ___gxx_personality_v0 collect2: ld returned 1 exit status If anybody can offer some advice, or show me a good starters guide to writing/compiling c/c++ in *nix, that be great. Thanks so much. Ed Last edited by System_159; 09-12-2007 at 04:09 PM. Reason: answered previous question, new question added |
| System_159 is offline | |
| | #2 |
| and the hat of Jobseeking Join Date: Aug 2001 Location: The edge of the known universe
Posts: 21,680
| g++ prog.cpp -lcurses |
| Salem is offline | |
| | #3 |
| Registered User Join Date: Aug 2006
Posts: 159
| Thanks. That solved the curses.h linker error. What do I for custom header files? I've got three header files that I'm including: Code: #include "includes/mnemonics.h" #include "gui/draw_menu.h" #include "gui/menus.h" |
| System_159 is offline | |
| | #4 |
| Protocol Test Engineer Join Date: Sep 2005 Location: fseek(UK)
Posts: 1,324
| Code: g++ -I../includes../gui -o helloworld helloworld.cpp -lcurses Last edited by ssharish2005; 09-12-2007 at 06:55 PM. |
| ssharish2005 is offline | |
| | #5 | |
| Woof, woof! Join Date: Mar 2007 Location: Australia
Posts: 3,295
| Do nothing with the custom header files, leave them as they are, don't attempt to compile them seperatly (ie just leave the compiler switches as they are). You may also want to turn up the warning level and stuff, do a man gcc You don't need to specify -I, because you explicitly define the directory where the headers are. Quote:
Last edited by zacs7; 09-12-2007 at 10:17 PM. | |
| zacs7 is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Issue with program that's calling a function and has a loop | tigerfansince84 | C++ Programming | 9 | 11-12-2008 01:38 PM |
| Need help with a program, theres something in it for you | engstudent363 | C Programming | 1 | 02-29-2008 01:41 PM |
| This is a simple program.. Help me please I think it has an error.. | lesrhac03 | C Programming | 4 | 02-21-2008 10:39 AM |
| My program, anyhelp | @licomb | C Programming | 14 | 08-14-2001 10:04 PM |