土建立在Visual Studio 2010 [英] SOIL set-up in Visual Studio 2010

查看:272
本文介绍了土建立在Visual Studio 2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能得到 的土壤与Visual Studio 2010中正常工作 - 我根本不是一个专家与VS但据我所知,只有下列步骤是必要的,以获得环境工作:

属性>> C / C ++>常规>>附加包含目录
添加在路径SOIL.h

属性>>链接>>通用>>附加库目录
添加在路径libSOIL.a

我也使用免费GLUT和路径都在这里设置以及过剩的文件 - 我还设置了Dubugging >>环境的路径GLUT bin文件

当我用我SOIL_load_OGL_texture收到以下错误:

错误LNK2019:​​在函数引用解析外部符号_SOIL_load_OGL_texture无效__cdecl的init(无效)(?INIT @@ YAXXZ)

试过重命名为libSOIL.a和libSOIL.lib但SOIL.lib没有工作。然后,我建立了VC8项目,并使用了的.lib作为这里建议
土壤无法正常连接但也不能工作。

我使用的样本code从他们的网页

  GLuint tex_2d;
tex_2d = SOIL_load_OGL_texture
    (
        C:\\\\ Sunset.png
        SOIL_LOAD_AUTO,
        SOIL_CREATE_NEW_ID,
        SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COM preSS_TO_DXT
    );/ *在加载过程中检查错误* /
如果(0 == tex_2d)
{
    的printf(土加载错误:'%s'的\\ n,SOIL_last_result());
}


解决方案

这听起来像你实际上并没有把 SOIL.lib 属性 - >链接 - >输入 - >附加依赖列表。

该FreeGLUT头有 Win32的一些具体的#pragma 取值拉在适当的的.lib 的文件,这就是为什么只设置了附加库目录工作了这一点。土壤没有这些,所以你必须明确告诉的.lib 来使用的连接器。

I cant get SOIL working correctly with Visual Studio 2010 – I’m far from an expert with VS but as far as I know only the following steps are necessary to get the environment working:

Properties>>C/C++>General>>Additional include directories Add in the path to SOIL.h

Properties>>Linker>>General>>Additional Library Directories Add in the path to libSOIL.a

I am also using free GLUT and the paths to the glut files are set here as well – I also set the Dubugging>>Environment Path to the GLUT bin file.

When I use the SOIL_load_OGL_texture I get the following error:

error LNK2019: unresolved external symbol _SOIL_load_OGL_texture referenced in function "void __cdecl init(void)" (?init@@YAXXZ)

Tried renaming libSOIL.a to libSOIL.lib and SOIL.lib but it didn’t work. I then built the VC8 project and used that .lib as suggested here SOIL not linking correctly but that didn’t work either.

I am using sample code from their homepage

GLuint tex_2d;
tex_2d = SOIL_load_OGL_texture
    (
        " C:\\Sunset.png",
        SOIL_LOAD_AUTO,
        SOIL_CREATE_NEW_ID,
        SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT
    );

/* check for an error during the load process */
if( 0 == tex_2d )
{
    printf( "SOIL loading error: '%s'\n", SOIL_last_result() );
}

解决方案

It sounds like you didn't actually put SOIL.lib in your Properties -> Linker -> Input -> Additional Dependencies list.

The FreeGLUT header has some Win32-specific #pragmas to pull in the proper .lib files, which is why just setting the Additional Library Directories worked for that. SOIL doesn't have those so you have to specifically tell the linker which .lib to use.

这篇关于土建立在Visual Studio 2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆