Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problem with install SFML.NET to C++/CLI  (Read 7724 times)

0 Members and 1 Guest are viewing this topic.

ThreeDumps

  • Newbie
  • *
  • Posts: 34
    • View Profile
Problem with install SFML.NET to C++/CLI
« on: October 05, 2011, 12:49:07 am »
VS 2008
SFML 1.6
I download "SFML.Net full SDK".
Normal SFML works fine in C++ projects but in C++/CLI i have linker errors.

1. I can`t find include folder in "dotnet" (but alredy have added includes form C++ SFML).
2. I add folder with libs form "dotnet"
3. I have no libs in "dotnet/lib" only *.dll-s, so i don`t know what write in Linker/Input
4. Add macro
5. Copy *.dll from "dotnet/lib" to project

And now have linker errors...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with install SFML.NET to C++/CLI
« Reply #1 on: October 05, 2011, 07:45:37 am »
There are no C++ headers/libraries for SFML.Net, only assemblies. I don't know if you can link assemblies in C++/CLI (probably?).

Why don't you use the C++ version of SFML directly?
Laurent Gomila - SFML developer

ThreeDumps

  • Newbie
  • *
  • Posts: 34
    • View Profile
Problem with install SFML.NET to C++/CLI
« Reply #2 on: October 05, 2011, 03:15:47 pm »
My game is in C++ and i was using C++ SFML.

Now i want to make Map Editor and i want to use Windows Forms so I think i must use SFML.NET in Map Editor?

I set project with Windows Forms with SMFL C++ but have linker errors, now i set SFML.NET but still have linker error... I don`t know what do.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with install SFML.NET to C++/CLI
« Reply #3 on: October 05, 2011, 03:23:01 pm »
Can't you use native C++ together with Windows Forms?
Laurent Gomila - SFML developer

ThreeDumps

  • Newbie
  • *
  • Posts: 34
    • View Profile
Problem with install SFML.NET to C++/CLI
« Reply #4 on: October 05, 2011, 04:31:42 pm »
Windows Forms work only with C++/CLI not with C++

When I open Windows Forms in Micosoft Visual C++ 2008, automatically i write in C++/CLI

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with install SFML.NET to C++/CLI
« Reply #5 on: October 05, 2011, 04:41:50 pm »
You can write C++ in a C++/CLI project. That's exactly why C++/CLI exists.
Laurent Gomila - SFML developer

ThreeDumps

  • Newbie
  • *
  • Posts: 34
    • View Profile
Problem with install SFML.NET to C++/CLI
« Reply #6 on: October 05, 2011, 05:31:00 pm »
So why in C++/CLI i have
1>MapEditor - 7 error(s), 394 warning(s)
and
1>F:\Visual Proj\WizzMapEditor\Debug\MapEditor.exe : fatal error LNK1120: 6 unresolved externals

but in C++ projekt everything works?

so what I need to do than in a new project to work SFML?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with install SFML.NET to C++/CLI
« Reply #7 on: October 05, 2011, 11:15:30 pm »
What are these errors?
Laurent Gomila - SFML developer

ThreeDumps

  • Newbie
  • *
  • Posts: 34
    • View Profile
Problem with install SFML.NET to C++/CLI
« Reply #8 on: October 05, 2011, 11:48:04 pm »
Errors was:

1. Warrnings like this:
1>F:\Programy\!Biblioteki\SFML-1.6\include\SFML/Graphics/String.hpp(186) : warning C4272: 'sf::String::~String' : is marked __declspec(dllimport); must specify native calling convention when importing a function.

2. Linker errors like this:
1>MapEditor.obj : error LNK2028: unresolved token (0A00001B) "public: __clrcall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (??0RenderWindow@sf@@$$FQAM@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function "private: void __clrcall WizzMapEditor::Form1::Form1_Load(class System::Object ^,class System::EventArgs ^)" (?Form1_Load@Form1@WizzMapEditor@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)

3. Total:
1>F:\Visual Proj\WizzMapEditor\Debug\MapEditor.exe : fatal error LNK1120: 6 unresolved externals
1>MapEditor - 7 error(s), 394 warning(s)


Now i make it works but... from a different way

1. Create new empty project (not Windows Form Application)
2. Set SFML C++ like normal (add macro and libs to Input)
3. Add Item -> New item, UI->Windows Form
4. Set supprot for CLI in project options
5. Compile.
6. You must write by yourself basis of application with is ready when you use Windows Form App

No linker error, no warrnings. SFML work fine! When I do this same with New Projekt -> Windows Forms Application, i have errors and headache (from two days).

I received what I wanted to have.
Thank you for your help.
I hope that it was impossible to understand what I wos wrote :) (sorry for language mistakes). Last question, why is this difference between empty projekt with CLI support and, and Windows Forms App?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with install SFML.NET to C++/CLI
« Reply #9 on: October 06, 2011, 07:54:44 am »
Quote
Last question, why is this difference between empty projekt with CLI support and, and Windows Forms App?

I have no idea. Maybe you can compare the options in both projects to find out what's different.
Laurent Gomila - SFML developer

eigenbom

  • Full Member
  • ***
  • Posts: 228
    • View Profile
Re: Problem with install SFML.NET to C++/CLI
« Reply #10 on: June 15, 2012, 08:15:33 am »
for future reference, u can fix this issue with the global setting:
Common Language Runtime Support = Common Language Runtime Support (/clr)