Domanda

When i compile with the following command:

g++ -fPIC -o obj/buffer.o buffer.cpp

I get the following error:

/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crt1.o: In function _start': (.text+0x20): undefined reference tomain'

I am thought with the -fPIC flag, I didn't need a main function. I get this error with all of the cpp files. I do have a main.cpp that has the shared library functions in it. You can get the source code at the following:

git clone https://github.com/nterry/39DLL-4-Linux.git

Any ideas? I know that I can use the ld binary to put all of the o files in the an so once they're done, I just need help in building them all into shareable .o files

È stato utile?

Soluzione

I think that I answered my question. I added a -c to the command and it seems to have worked. Here is the command I used:

g++ -fPIC -c -o obj/list.o list.cpp

That is one of several cpp files, and all seemed to work.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top