很简单的静态库编译出现了问题
定义了头文件:
Function.h
void Print();
c++文件:Function.cpp
#include "Function.h"
void Print(){
std::cout<<"HelloWorld!!!"<<std::endl;
}
然后,点击build,报错如下:
1>D:\VS2010WorkSpace\TestLib\TestLib\TestLib.vcxproj(1,1): error MSB4025: 未能加载项目文件。给定编码中的字符无效。 第 1 行,位置 1。
以下是TestLib.vcxproj的内容
<?xml version="1.0" encoding="utf-8"?>
Debug
Win32
Release
Win32
{13C58112-2513-4B7B-8C69-5CA15D83A6C1}
Win32Proj
TestLib
StaticLibrary
true
Unicode
StaticLibrary
false
true
Unicode
Level3
Disabled
WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
Windows
true
Level3
MaxSpeed
true
true
WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
Windows
true
true
true
跪求大神指点迷津
首先,不要用中文命名你的项目
而vcxproj文件默认的编码方式是utf-8
你可以用记事本打开vcxproj,然后另存为,选择编码为utf8看看。
@caozhy 您好,这种方式我已经试过了,vcxproj文件和另外的.cpp .h文件的编码格式都已经改为utf-8,可是问题依然存在
LZ解决了吗? 我这个问题也一直没办法解决 能不能教我
对啊,这个问题我也遇到了就是没解决。好烦啊