I edited the question after David Hanak's answer (thanks btw!). He helped with the syntax, but it appears that I wasn't using the right function to begin with.
Basically what I want is to let the compiler ignore multiple definitions of a certain label and just use the first. In order to do that, I thought I'd just do something like this...
Hi All,
This may be very obvious question, pardon me if so.
I have below code snippet out of my project,
#include <stdio.h>
class X
{
public:
int i;
X() : i(0) {};
};
int main(int argc,char *arv[])
{
X *ptr = new X[10];
unsigned index = 5;
cout<<ptr[index].i<<endl;
return 0;
}
Question
Can I change the meaning of...
I want to use some functions from a .cpp source file that has a main function in my .cpp source file. (I'm building with make and gcc.)
Here's the rule from my Makefile:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SRCS) $(LIBS) -o $@
And here's the output (with some names changed to prevent distraction):
$ make foo
g++ -g -Wall -m32 -Ilinux/i...