|
|
Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » cpp/icpp name clashes [BUG?]
cpp/icpp name clashes [BUG?] [message #25649] |
Sat, 06 March 2010 02:25 |
|
Hello!
I just realized, that having package with .cpp and .icpp file of the same name leads to error, because the second object file rewrites the first. I'm not sure if it can be called a bug, but I think it should be at least mentioned somewhere in the documentation. Solution to this could be using different name or separate folder when compiling icpp files... Simple testcase follows:
File test.cpp: #include <Core/Core.h>
using namespace Upp;
extern int test;
CONSOLE_APP_MAIN{
Cout()<<"test: "<<test<<"\n";
} File test.icpp: #include <Core/Core.h>
using namespace Upp;
int test;
INITBLOCK{test=1;} This fails to link, but if you rename one of the files, it works as expected.
Best regards,
Honza
|
|
|
|
Re: cpp/icpp name clashes [BUG] [message #25658 is a reply to message #25649] |
Sat, 06 March 2010 17:43 |
Sender Ghost
Messages: 301 Registered: November 2008
|
Senior Member |
|
|
Hello, Jan.
I created attached patch to review, which solves mentioned problem. It can be applied for ide/Builders directory.
The main idea is to add file name with extension to object name.
As readers can see, the U++ developer(s) aware about this problem with rc and brc extensions, but they don't expand it for this problem with more simple solution.
Edit:
The contents of description and patch was changed.
[Updated on: Sun, 07 March 2010 14:31] Report message to a moderator
|
|
|
|
|
|
|
Re: cpp/icpp name clashes [BUG] [message #25803 is a reply to message #25801] |
Fri, 12 March 2010 12:24 |
|
luzr wrote on Fri, 12 March 2010 10:58 | Maybe only for extensions that are not .cpp?
|
And what if someone is stupid enough to have files "file.c" and "file.c.cpp"? (This post is mostly a joke... )
Honza
|
|
|
|
|
|
|
|
|
Re: cpp/icpp name clashes [BUG] [message #26136 is a reply to message #25839] |
Mon, 05 April 2010 11:35 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Many would consider this as something a programmer should be aware of rather than an IDE/compiler bug.
Why would someone need/want to have the file names the same except for the extension???
C++ has reserved words for a purpose, the same concept for file names that make up a package, application, library, includes, etc. would seem to make sense.
Whether the extension is .c, .cpp, .icpp, .o, .obj, .h, .dll or whatever
it should relate to the same "FileName". My mind is a bit slow on some things, having it otherwise would make my head hurt.
"FAT32 is very much alive"
[Updated on: Mon, 05 April 2010 12:10] Report message to a moderator
|
|
|
Re: cpp/icpp name clashes [BUG] [message #26137 is a reply to message #26136] |
Mon, 05 April 2010 12:21 |
|
Well, I admit that it is something that good programmer should know and be aware of. It's just that I'm not that good and I'm also quite lazy And I also found another name clash problem, this time even less noticeable. Let me show you on example:
Suppose I want to use libfoo with U++, so I decide to create a package plugin/foo. It is quite logical to put the wrapper code into plugin/foo/foo.cpp. Now I will copy the original sources into plugin/foo/lib subdirectory. It is quite likely that there will be a file plugin/foo/lib/foo.c. I wouldn't expect at all, that file with same name, but different extension and in different directory (!) may cause troubles. Yet it will fail to compile in theide...
The different directory problem is not related to the original post, but these two combined can make it much more confusing.
About FAT: You are right, FAT32 is alive. But it has no 8.3 problem. Long filenames were introduced into FAT in Win95. That means this problem doesn't exist anymore.
Regards,
Honza
|
|
|
Goto Forum:
Current Time: Thu Jun 13 07:34:41 CEST 2024
Total time taken to generate the page: 0.02057 seconds
|
|
|