본문 바로가기

C++4

자주 접하는 오류문들 error: ISO C++ forbids declaration of ‘자료형’ with no type-------------------------------------------------------------------------------------------원인 : 자료형이 제대로 선언되지 않은채 사용되었다.해결 : 1. 이 자료형이 선언된 헤더파일의 경로 및 파일이름이 올바른지 확인한다. 2. namespace안에 구현된 경우일 수도 있으니 namespace를 사용했는지 확인한다.error: 'NullLock' was not declared in this scope---------------------------------------------------------------------------.. 2023. 5. 9.
C++ Errors error LNK2019: __imp_WSAStartup12345678910111213LINK : xxxxxxxxxxxxxxxxxxxxx(를) 찾을 수 없거나 마지막 증분 링크에 의해 빌드되지 않았습니다. 전체 링크를 수행하고 있습니다.xxxxxx : error LNK2019: __imp_htons 외부 기호(참조 위치: "public: static int __cdecl ifs::core::wpl::Marshal::encode(void *,unsigned short)" (?encode@Marshal@wpl@core@ifs@@SAHPEAXG@Z) 함수)에서 확인하지 못했습니다.) : error LNK2001: __imp_htons 외부 기호를 확인할 수 없습니다.1>ifs100_test.lib(Marsha.. 2014. 11. 5.
Class 코딩시 알아두면 좋은 내용들 1. 멤버 함수의 파라미터에 default value 를 이용하고자 한다면 형선언 부분에만 넣어주고 구현 부분에는 넣지 않는다. (예) class testClass { private: void print(const char* message, ostream& outputStream = cerr) const; }; void testClass::print(const char* message, ostream& outputStream) const { outputStream 2008. 9. 30.
define 관련 재미있는 사용법 #define 에서 정의한 2개의 인자를 붙어서 하나의 스트링으로 쓸수 있다. 가령 func(x,y) 를 주었을때 x와 y의 내용을 붙어서 변수명으로 선언하고 싶은경우 아래의 방법을 참고하면 된다. #define concat(x,y) int x##y; 이런경우 아래에서 concat(Time, Check) 라고 사용하면 TimeCheck 를 int 형 변수로 이용할 수 있다. 실로 재미있는 일이다. http://msdn.microsoft.com/en-us/library/09dwwt6y(VS.80).aspx http://www.keil.com/support/man/docs/c166/c166_pp_tokenpastingop.htm 2008. 5. 6.