Results 1 to 2 of 2
hello, i'm new to linux programming, thow my programming experience under windows is quite good. I have a problem that i can't solve. Here it is, I hope someone will ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-24-2006 #1
- Join Date
- Mar 2006
g++ linking problem (my own .cpp files, no library)
i'm new to linux programming, thow my programming experience under windows is quite good. I have a problem that i can't solve. Here it is, I hope someone will enlight me upon this :
i have some cpp files and some .h files describing some classes.
I wrote a template list, a template stack, a template Queue and a template HashTable.
they seem to compile well, no errors. I use the following rule:
HashTable.o : HashTable.cpp HashTable.h
g++ -c HashTablethen I have a flex output fom a flex file. This also compiles without errors
g++ -o lex.yy.o ./lex.yy.c
The problems occur when I try to link the files (.o) togeder.
I need a HashTable in my flex program and I use the necessary #include directives in the flexygen.l file for including the header files (HashTable.h), but when linking:
project : lex.yy.o HashTable.o
g++ -o project lex.yy.o HashTable.oI get an error : undefined reference to HashTable<...my template type...>::addElement(...some type...).
does anyone have any idea?
- 03-25-2006 #2
- Join Date
- Aug 2005
Here is my two cents: try to specify first your HastTable object in this manner:
g++ -o project HashTable.o lex.yy.oWhen using Windows, have you ever told "Ehi... do your business?"
Linux user #396597 (http://counter.li.org)