I\'m trying to make a static library from a class but when trying to use it, I always get errors with undefined references on anything. The way I proceeded was creating the
This is probably a link order problem. When the GNU linker sees a library, it discards all symbols that it doesn't need. In this case, your library appears before your .cpp file, so the library is being discarded before the .cpp file is compiled. Do this:
g++ -o main.exe main.cpp -L. -lmylib
or
g++ -o main.exe main.cpp myClass.lib
The Microsoft linker doesn't consider the ordering of the libraries on the command line.