开发者

Linker problem when compiling with Qt Vs adding

I've got logic in .h files and they are compiling without problems (header guards are in place):

//file _1.h

#ifndef _1_HEADER
#define _1_HEADER
function definition in here
#endif

When trying to include this file and compile after creating qt project in vs i'm getting errors:

Error 7 error LNK1169: one or more multiply defined symbols found

I'm getting the idea. The linker complains because there are (in those header files) whole definitions of functions, but as they are guarded that shouldn't be a problem, especially when those same files compile fine 开发者_StackOverflow社区when compiled as not Qt project.


Without knowing more about the exact errors and seeing files it's hard to say, but it's important to note that when you are using Qt moc, the Meta Object Compiler, generates certain files for you which include various definitions of signals, etc.

Thus, if it's Qt only, I'd guess that it's related to one of the generated files. You might take a look at the moc_* and ui_* files and see if there's an obvious problem.

One other option is to run the C/C++ preprocessor on a file that exhibits the problem and search for the different definitions until you can identify where they are originating.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜