Hello everyone,
i'm trying to compile a simple c++ program with g++ and codebench.
The program works ok on Windows Code::Blocks/MinGW environment.
As soon as i try to compile on amigaos i get tons of error.
At first the errors was related to certain function written with the 0x11 c++ standard, that Amiga SDK doesn't support yet.
I avoided this problem setting Code::Blocks to work with ox00 standard that is supported by Amiga OS latest SDK, as stated in the sdk documentation.
Tried again to compile but getting 183 error, this time...
I paste just a few lines of the build log:
g++ -c -o ../Adventure/main.o ../Adventure/main.cpp
SDK:gcc/bin/gcc -o Adventure ../Adventure/main.o -lauto
../Adventure/main.o: In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
main.cpp:(.text+0x350): undefined reference to `std::string::size() const'
main.cpp:(.text+0x3b0): undefined reference to `std::string::operator[](unsigned int) const'
main.cpp:(.text+0x428): undefined reference to `std::string::operator[](unsigned int) const'
main.cpp:(.text+0x4b4): undefined reference to `std::string::operator[](unsigned int) const'
../Adventure/main.o: In function `collectObject(int)':
main.cpp:(.text+0x566): undefined reference to `std::cout'
main.cpp:(.text+0x56a): undefined reference to `std::cout'
main.cpp:(.text+0x574): undefined reference to `std::basic_ostream
main.cpp:(.text+0x598): undefined reference to `std::basic_ostream
main.cpp:(.text+0x5a6): undefined reference to `std::basic_ostream
main.cpp:(.text+0x5aa): undefined reference to `std::basic_ostream
main.cpp:(.text+0x5ac): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
Any hint?
Thank you very much
@AmigaBlitter
You need to use G++ for linking as well as compiling. Right now, you're using the C compiler to link a C++ program.
Try:
g++ -o Adventure ../Adventure/main.o -lauto
Hans
Join the Kea Campus - upgrade your skills; support my work; enjoy the Amiga corner.
https://keasigmadelta.com/ - see more of my work
Thank you, Hans
The build log start with
g++ -c -o ../Adventure/main.o ../Adventure/main.cpp
SDK:gcc/bin/gcc -o Adventure ../Adventure/main.o -lauto
i thought that automatically started with g++ as in the first line of the log...
Going to try manually...
Tested, and it works!!! Thank you again.
Investigating now how can i setup CodeBench to use the right compiler.
If you use the gcc command instead of g++ for linking it won't link with the stdc++ library automatically so you need to specify it manually with -lstdc++.