Tag: C
Ubuntu version: 18.04.2Python version: 3.6g++ version: 7.3.0clang version: 6.0.0swig version: 3.0.12OpenCV version: 4.0.0 [C++ code] class Image { private: cv::Mat mat; public: Image() {} }; The following errors occur when importing my module after binding…
boost python 사용시 (ver.1.3.7) 컴파일하면 다음과 같은 에러가 발생할 수 있다. /usr/include/bits/fcntl.h:227: error: reference to ‘ssize_t’ is ambiguous /usr/include/sys/types.h:110: error: candidates are: typedef __ssize_t ssize_t /usr/local/include/boost-1_37/boost/python/ssize_t.hpp:15: error: typedef Py_ssize_t boost::python::ssize_t /usr/include/bits/fcntl.h:227: error: reference to ‘ssize_t’…
범하기 쉬운 실수 (CentOS 64비트 버전에서 테스트) class A { public: float a[3]; A() {} ~A() {} }; => sizeof(A) = 12 class A { public: …
자신만의 library에 String이라는 class를 만들게 되면 Windows에서는 괜찮지만 Linux에서는 다음과 같은 error에 직면하게 된다. /usr/include/X11/Intrinsic.h:326: error: reference to ‘String’ is ambiguous. 리눅스 때문에 String이라는 좋은 이름을 두고 FString 등의 이름으로 바꿔야 하나 고민했지만, google이 문제를…
template <class T> // or template <typename T> class A { public: A() {} ~A() {} void aaa() { std::list<T> aList; … std::list<T>::iterator itr =…
#define LIFESPAN 0x000002 bool hasLifespan( int attrBitMask ) { return ( attrBitMask & LIFESPAN ); } 위와 같은 code가 있다고 했을 때, 다음과 같은 경고(warning)이 발생할 수 있다. warning C4800: ‘int’ : ‘true’ 또는 ‘false’로 bool…
#include <Process.h> int main( int argc, char** argv ) { system( "ls" ); return 0; } 이러한 방식으로 system() 함수를 이용하여 외부 프로그램을 실행할 수 있다. 하지만, system 함수는 실행 결과의 상태를 알려주는 int 값을…
class A { public: int &x; int y; A(): x(y), y(0) {}; }; int main( int argc, char** argv ) { A a; cout << a.x << endl; cout << a.y << endl; cout <<…
class A { public: int data[2]; int &x, &y; A(): x(data[0]), y(data[1]) {} A( int xx, int yy ): x(data[0]), y(data[1]) { x=xx; y=yy; } }; int main( int argc,…
void aaa( char* str ) { … } 일 때, aaa( “abcdefg” ); 라고 실행하면 발생하는 에러이다. 두 가지의 해결방법이 있다. 첫 번째, void aaa( const char* str ) { … } 와 같이 수정한다….
class A { public: int a, b; A(): b(0), a(0) {} }; 만약 위와 같은 code를 사용했을 때, gcc에서 다음과 같은 warning이 발생할 수 있다. warning: ‘A::a’ will be initialized after warning:…
“undefined refernce to…” 이러한 error는 source code에서 어떤 외부 library를 사용하지만 해당 library가 link되어 있지 않아서 code 내용을 가져올 수 없기 때문에 발생하는 error이다. 여기서는 libz를 찾지 못해서 발생하는 compile error이므로, Makefile에 -lz 를 추가해주면…
class A { public: float x; A(): x(0) {} }; std::vector av; A a; av.push_back( a ); 했을 때, can’t use default assignment operator 와 같은 error가 발생한다면, class A 에 다음…
Visual Studio에서 다음과 같은 compile error가 발생할 때가 있다. UTL error C2872: ‘ostream’ : ambiguous symbol 이럴 때에는 C/C++ -> Preprocesser -> Preprocessor Definations에 REQUIRE_IOSTREAM를 추가해주면 된다.
다음과 같은 error가 발생할 때, C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\include\windef.h(122) : warning C4005: ‘CALLBACK’ : macro redefinition C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\GL/glut.h(34) : see previous definition of ‘CALLBACK’ #include <windows.h>를 #include <glud.h>…
C:\Program Files\Microsoft Visual Studio 8\VC\include\stdlib.h(406) : error C2381: ‘exit’ : redefinition; __declspec(noreturn) differs C:\Program Files\Microsoft Visual Studio 8\VC\include\GL/glut.h(146) : see declaration of ‘exit’ \sourceCode\main.cpp(362) : error C3861: ‘exit’: identifier not found 이러한 에러 발생시 해결법…