요 두가지 차이점에 관해서..

psjcap의 이미지

클레스를 하나 만듭니다..
일단 이름을 CMyClass 라고 하구요..
헤더 파일과 소스파일을 각각 별도 파일로 만들었습니다..
헤더 파일 이름은 CMyClass.h.. 소스파일은 CMyClass.cpp

근데.. 다른 파일에서 이 클래스를 사용하기 위해서..
#include "CMyClass.h" <-- 이렇게 하는 것과..
class CMyClass <-- 이렇게 하는 거에 차이가 뭔가요..??

위처럼 include하고 컴파일하니깐..
Error: "}" expected instead of "end of file". <-- 이런 에러 나는 경우가 있어서..

ihavnoid의 이미지

psjcap wrote:
클레스를 하나 만듭니다..
일단 이름을 CMyClass 라고 하구요..
헤더 파일과 소스파일을 각각 별도 파일로 만들었습니다..
헤더 파일 이름은 CMyClass.h.. 소스파일은 CMyClass.cpp

근데.. 다른 파일에서 이 클래스를 사용하기 위해서..
#include "CMyClass.h" <-- 이렇게 하는 것과..
class CMyClass <-- 이렇게 하는 거에 차이가 뭔가요..??

위처럼 include하고 컴파일하니깐..
Error: "}" expected instead of "end of file". <-- 이런 에러 나는 경우가 있어서..

#include 은, 그 파일의 내용을 그대~~~~~로 copy and paste를 해서 붙여넣는 것과 동일한 효과를 가져옵니다.
CMyClass.h 의 내용을 cpp 파일에 그대로 붙여넣을 경우 어떻게 될 지 생각해보세요. (무슨 내용이 들어있는지 모르겠어서 정확한 답변은 못 드리겠네요 -0-)

그냥 제 생각에는, vc++에서 작업하시는 것 같은데, 그럴 경우 #include 가 정석일 것이라 생각됩니다.

Consider the ravens: for they neither sow nor reap; which neither have storehouse nor barn; and God feedeth them: how much more are ye better than the fowls?
Luke 12:24

psjcap의 이미지

솔라리스 8입니다..
define이 중복되는 문제가 아닌가 생각 중인데..
찾기가 쉽지 않네요..ㅠㅠ

소스를 너무 복잡하게 짜 놔서..
남 소스 보기가 정말 어렵네요..ㅠㅠ

pynoos의 이미지

-E 나 -save-temps 를 넣어 preprocessing 결과를 보세요.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.