From: Lawrence S. <blu...@gm...> - 2016-12-30 05:55:18
|
Your test program. Assuming you’re starting from the PNG example Makefile, find this portion of the Makefile: example.elf: $(OBJS) romdisk_boot.o $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $@ $(KOS_START) $^ -lpng -lz -lm $(KOS_LIBS) Change it to look like this: example.elf: $(OBJS) romdisk_boot.o kos-c++ -o $@ $^ -lpng -lz -lm If you’re not using a romdisk, get rid of the romdisk_boot.o stuff too, of course. - Lawrence > On Dec 29, 2016, at 11:48 PM, Nathan Meier <gro...@gm...> wrote: > > Are talking about KOS's Makefile or my test program's Makefile? > > On Thu, Dec 29, 2016 at 7:42 PM, Lawrence Sebald <blu...@gm... <mailto:blu...@gm...>> wrote: > Compile and link with kos-c++ in your Makefile, rather than $KOS_CC or whatever it is your makefile is currently using. > > The issue here is that you’re not linking in the standard C++ library at all, which causes problems if you try to use any of it. > > - Lawrence > > > On Dec 29, 2016, at 10:24 PM, Nathan Meier <gro...@gm... <mailto:gro...@gm...>> wrote: > > > > So I'm in the process of converting code over from c to c++.(The code was based of the PNG example.) > > > > Currently I'm trying to use functions from the standard library like #include<vector>, #include<string> and #include<fstream>. > > > > When I try and compile the program in Cygwin. I get these errors coming up and interrupting the process. > > > > The errors I'm getting are in this block of text it returns back to me: > > > > > > /home/YouPeople/dc/kos//utils/bin2o/bin2o romdisk_boot.img romdisk_boot romdisk_boot.o > > /opt/toolchains/dc/sh-elf/bin/sh-elf-gcc -O2 -fomit-frame-pointer -ml -m4-single-only -ffunction-sections -fdata -sections -I/home/YouPeople/dc/kos//include -I/home/YouPeople/dc/kos//kernel/arch/dreamcast/include -I/home/You People/dc/kos//addons/include -I/home/YouPeople/dc/kos//../kos-ports/include -D_arch_dreamcast -D_arch_sub_prist ine -Wall -g -fno-builtin -fno-strict-aliasing -ml -m4-single-only -Wl,-Ttext=0x8c010000 -Wl,--gc-sections -T/h ome/YouPeople/dc/kos//utils/ldscripts/shlelf.xc -nodefaultlibs -L/home/YouPeople/dc/kos//lib/dreamcast -L/home/Y ouPeople/dc/kos//addons/lib/dreamcast -L/home/YouPeople/dc/kos//../kos-ports/lib -o example.elf example.o wfont .o romdisk_boot.o -lpng -lz -lm -Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group > > example.o: In function `__check_facet<std::ctype<char> >': > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_stor age' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `std::ios_base::ios_base()' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `vtable for std::basic_ios<char, std::char_traits<char> >' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `VTT for std::basic_ifstream<char, std::char_traits<char> >' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits <char> >*)' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `vtable for std::basic_ifstream<char, std::char_traits<char> >' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `vtable for std::basic_ifstream<char, std::char_traits<char> >' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `std::basic_filebuf<char, std::char_traits<char> >::basic_filebuf()' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `std::basic_filebuf<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode)' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `std::basic_istream<char, std::char_traits<char> >& std::getline<char, std::char_traits<char>, s td::allocator<char> >(std::basic_istream<char, std::char_traits<char> >&, std::basic_string<char, std::char_trai ts<char>, std::allocator<char> >&, char)' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_leak_hard()' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:51: undefin ed reference to `std::__throw_bad_cast()' > > example.o: In function `_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate': > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `std::ctype<char>::_M_widen_init() const' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `VTT for std::basic_ifstream<char, std::char_traits<char> >' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `std::basic_filebuf<char, std::char_traits<char> >::close()' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `vtable for std::basic_ifstream<char, std::char_traits<char> >' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `vtable for std::basic_ifstream<char, std::char_traits<char> >' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `vtable for std::basic_filebuf<char, std::char_traits<char> >' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `std::__basic_file<char>::~__basic_file()' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `vtable for std::basic_streambuf<char, std::char_traits<char> >' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `std::locale::~locale()' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `std::ios_base::~ios_base()' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `vtable for std::basic_ios<char, std::char_traits<char> >' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/basic_ios.h:130: undefi ned reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)' > > example.o: In function `_ZNSs4_Rep10_M_disposeERKSaIcE': > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/stl_vector.h:161: undef ined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_st orage' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/stl_vector.h:161: undef ined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::bas ic_string<char, std::char_traits<char>, std::allocator<char> > const&)' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/stl_vector.h:161: undef ined reference to `std::__throw_bad_alloc()' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/stl_vector.h:161: undef ined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)' > > /opt/toolchains/dc/sh-elf/lib/gcc/sh-elf/4.7.3/../../../../sh-elf/include/c++/4.7.3/bits/stl_vector.h:161: undef ined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std: :allocator<char> const&)' > > collect2: error: ld returned 1 exit status > > make: *** [Makefile:33: example.elf] Error 1 > > > > I wanna try and make sense of this, but have no idea where to begin. Or what the problem even is. Please help! > > ------------------------------------------------------------------------------ > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________ <http://sdm.link/slashdot_______________________________________________> > > cadcdev-kallistios mailing list > > cad...@li... <mailto:cad...@li...> > > https://lists.sourceforge.net/lists/listinfo/cadcdev-kallistios <https://lists.sourceforge.net/lists/listinfo/cadcdev-kallistios> > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot <http://sdm.link/slashdot> > _______________________________________________ > cadcdev-kallistios mailing list > cad...@li... <mailto:cad...@li...> > https://lists.sourceforge.net/lists/listinfo/cadcdev-kallistios <https://lists.sourceforge.net/lists/listinfo/cadcdev-kallistios> > > |