This is a discussion on Help with reusing code - Programmer ; Hello, I really hope someone can help me. I apologize if this is not the correct place for this question but I really need some advice. Until recently I have been happily coding in Java. For several reasons I have ...
Hello, I really hope someone can help me. I apologize if this is not
the correct place for this question but I really need some advice.
Until recently I have been happily coding in Java. For several
reasons I have now had a need to do some stuff in C++. The majority
of my work is console based scientific computing type stuff. Having a
Java background, it makes sense to me to build myself some classes
which I can reuse, a Matrix class for example. In Java I would do
this, then simply use 'import' to make all the functionality visible
to any class that needs them. I am now attempting to do this in C++
and I am not having much luck. Is there some way to accomplish what I
want to do? It seems so simple like I should just be able to tell any
class or function where to find what it needs. Unfortunately I am out
I am working in Visual Studio 2005. I have written some classes in a
project called "General" and I am now trying to use them in a new
project, say, "MyFirstProject". In the #include statements I specify
the header files as "../General/Matrix.h". This works for the compile
stage so I know that the new project can see the definitions at
least. It does not survive the linking stage, however. I have tried
adding a reference to General but that did not help. I tried building
a .lib file out of General but that causes a bunch of duplicate
definition errors. After playing around with runtime library settings
(of which I know nothing) I got it all to link fine, but then when I
run it tells me it cannot recognize the library's binary format.
I am out of ideas. Surely there must be a way to accompoish what I
want. Any help, pointers, websites would be very much appreciated.
Thanks in advance.