开发者

Linking error in MSVC 2008

开发者 https://www.devze.com 2023-04-07 06:44 出处:网络
I have a file structure like this: file1.h extern const char *build_info[][3]; file1.cpp #include \"file1.h\"

I have a file structure like this:

file1.h

extern const char *build_info[][3];

file1.cpp

    #include "file1.h"

    const char *build_info[][3] = {
       { "abc", "de", "feg" },
       { ... }, 
        ...
        };

file2.开发者_如何转开发cpp

// Use build_info

Now I am getting this erro under MSVC 2008 Express

file2.obj : error LNK2001: unresolved external symbol "char const * (* build_info)[3]"

Looks like I am not able to link file1.obj. Any idea how I can verify:

  • Whether the obj is linked.
  • It has the symbol defined.


Okay I found the problem, file1.cpp was actually file.c. Only I enclosed that in

extern C { .. }

it is working fine.

0

精彩评论

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

关注公众号