Cannot compile C++ program with custom header files in Linux -
i'm new c++ , i'm having problem trying compile program. have driver.cpp
file contains main()
, , 2 header files each corresponding .cpp
files. in same directory. driver.cpp
file calls function in 1 of other header files, rest of work. problem cannot compile code maintain getting "undefined symbol first referenced in file" errors. i've tried many different ways of writing compile code none works. here 1 tried:
"g++ -lm -o outputfile headerone.cpp headertwo.cpp driver.cpp"
if can help me out i'd appreciate it. thanks!
edit: way, tried code in visual studio before set linux , worked. not sure if means anything, thought i'd add together in here. allow me know if need attach code.
i figured out! turns out didn't have variables defined in .cpp files "extern" in .h files , missing "inline" in function definitions. anyway help!
c++ linux
No comments:
Post a Comment