Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone:

I'm working with Visual Studio 2008, and I have multiple CPP files in
the project. I'd like to compile these files, but not to link them,
because they are all MATLAB interface functions with the same function
names. Linking these functions cause the linker to complain, which is
not a big problem. However, I still want to fix it. Is there any way
to tell the linker to avoid certain object files?

Thanks
Posted

Why not just exclude the extra modules from the project? I cannot see any need to compile a module if you do not link it in.
 
Share this answer
 
You could add namespaces to avoid the function name collisions.

Of course, If you KNOW there will collisions, why don't you name them something like "MATLAB_xxxx"? This way, the compiler will simply not link them if they're not used.

You could also put the functions into a lib, and simply not link to it when you don't need it.
 
Share this answer
 
Thanks for replying to me folks.

I should have explained better: the reason I want to include files that I don't need to link is because I want to use Visual Studio for my MATLAB projects. Visual Studio provides much more powerful editing functions than MATLAB editor, so I usually use Visual Studio to edit and compile, then test it using MATLAB. Because MATLAB has a fixed name for its interface function, so whenever I create two interface functions, Visual Studio will complain about the duplication of names.

I'll try the name-space approach or, maybe I need a method to turn off the entire linking process.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900