Is there a way to tell the IDE that a .cpp file, despite being in the project, must not be compiled, like the "exclude from build" option in Micorsoft Visual C++?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2004-03-16
why don't you remove it from the project if your not going to use it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Because I am going to use it, even though it doesn't always have to be compiled.
For example, when I want to have two incompatible (in the sense that they cannot be linked together) implementations for a class and be able to switch from one implementation to the other quickly.
An alternative would be to create two different projects but this would make them difficult to manage, since I would have to do twice all the operations like adding/removing files, changing project properties. Otherwise I could put both implementations in the same file and comment out the one that I'm not interested in, but this is quite messy too.
Also another situation in which it turns out useful is with templates. In order to keep interface and implementation separate (while waiting for support for the export keyword) I still write a .h file and a .cpp file, doing an #include<.cpp file> in the .h file. Obviously, the .cpp file must not be compiled in this case. I could change the extension of the .cpp file to something like .inl, but this would (probably) prevent me from using the "swap header/source" option in the editor.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not sure I understand what you mean, anyway right now I'm just trying to compile my personal tools-library which I had written using Visual C++ and the problem arised with templated classes
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there a way to tell the IDE that a .cpp file, despite being in the project, must not be compiled, like the "exclude from build" option in Micorsoft Visual C++?
Thanks
why don't you remove it from the project if your not going to use it?
Because I am going to use it, even though it doesn't always have to be compiled.
For example, when I want to have two incompatible (in the sense that they cannot be linked together) implementations for a class and be able to switch from one implementation to the other quickly.
An alternative would be to create two different projects but this would make them difficult to manage, since I would have to do twice all the operations like adding/removing files, changing project properties. Otherwise I could put both implementations in the same file and comment out the one that I'm not interested in, but this is quite messy too.
Also another situation in which it turns out useful is with templates. In order to keep interface and implementation separate (while waiting for support for the export keyword) I still write a .h file and a .cpp file, doing an #include<.cpp file> in the .h file. Obviously, the .cpp file must not be compiled in this case. I could change the extension of the .cpp file to something like .inl, but this would (probably) prevent me from using the "swap header/source" option in the editor.
in [project options - files] you can click the file and uncheck "include in compilation"
I haven't tried it though..
Adrian
It works, thanks.
Are you trying to mix object files, or do you just have something thats horrendus to compile?
Wayne
I'm not sure I understand what you mean, anyway right now I'm just trying to compile my personal tools-library which I had written using Visual C++ and the problem arised with templated classes