1
저는 벡터를 만들려고하고 있지만 큰 오류가 발생하며 다른 프로젝트의 예제를 따르고 있습니다. 코드 :벡터를 초기화 할 때 심한 오류가 발생했습니다.
#include <stdio.h>
#include <stdlib.h>
#include <vector>
using namespace std;
struct organism {
bool One;
bool Two;
};
std::vector<organism> organisms;
int main() {
printf("Content-type: text/html\n\n");
printf("TEST");
printf(getenv("QUERY_STRING"));
return 0;
}
오류 : 나는 std::vector<organism> organisms;
을 주석하지만 난 그 라인 뭐가 잘못 단서가없는 경우
> "make"
C:/MinGW/bin/gcc.exe -o build/e2.exe source/main.cpp
C:\Users\Stephen\AppData\Local\Temp\ccc0a0w2.o:main.cpp:(.text$_ZN9__gnu_cxx13new_allocatorI8organismE10deallocateEPS1_j[__gnu_cxx::new_allocator<organism>::deallocate(organism*, unsigned int)]+0xd): undefined reference to `operator delete(void*)'
C:\Users\Stephen\AppData\Local\Temp\ccc0a0w2.o:main.cpp:(.eh_frame$_ZNSt12_Vector_baseI8organismSaIS0_EED2Ev+0x13): undefined reference to `__gxx_personality_v0'
C:\Users\Stephen\AppData\Local\Temp\ccc0a0w2.o:main.cpp:(.eh_frame$_ZNSt6vectorI8organismSaIS0_EED1Ev+0x13): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
"make": *** [build] Error 1
> Process Exit Code: 2
> Time Taken: 00:01
내가 그것을 컴파일 할 수 있습니다. 다른 프로젝트에서도 똑같습니다. 컴파일해도 괜찮습니다.
Damnit. g ++ 대신 gcc로 컴파일하여 다른 문제를 수정했습니다. CGI/Apache에서는 g ++이 작동하지 않습니다. –
아마도이 문제를 별도의 질문으로 질문해야합니다. :) –
'gcc'로 컴파일 할 수도 있지만'-lstdC++'옵션을'gcc -o build/e2.exe source/main.cpp -lstdC++'에 올바르게 링크 된 C++ 라이브러리를 얻기 위해 전달할 수 있습니다. –