Thread: Mixing C++ class and non-class code?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    3

    Mixing C++ class and non-class code?

    Hi, I am building a Qt C++ application, and bumped into this issue.

    Usually all my files are classes, and to use a class from another I'd simply include the header file and it's done.

    Now I have this c++ module, say A, it has only 2 files, A.cpp and A.h. Unlike my other files A is not a class, it is just like a c module. Say class B wants to use functions in A, I've tried including A.h in B, but it gets an undefined reference error when I try to compile it... I could turn A into a class and make all its functions static, but I am wondering if you can just call to it directly and use its functions...

    Not sure if I worded it clear, I'll post some code if it's necessary.

    Thanks.

    ----
    EDIT:
    I've just found out how to do it properly... it'd be good if the topic can be closed or deleted.
    Last edited by Depthcharge101; 05-26-2009 at 11:30 PM. Reason: resolved

Popular pages Recent additions subscribe to a feed