cs_PoLoCh
Messages postés33Date d'inscriptionlundi 28 avril 2003StatutMembreDernière intervention23 août 2008
-
10 mai 2007 à 20:37
cs_PoLoCh
Messages postés33Date d'inscriptionlundi 28 avril 2003StatutMembreDernière intervention23 août 2008
-
14 mai 2007 à 22:12
Bonjour a tous je me lance dans VS2005, et jai un ptit probleme voila, jai un code en C deja fai, et jai creer mon interface graphique avec C++ sur vs2005, jai lu que je pouvai inclure mes fonction C, pour cela je dois juste inclure comme ceci ma header file,
extern "C" {
// Fournir la déclaration de f(int i, char c, float x)
#include "main.h"
}
, malheuresement ça ne marche pas, quand jessaye d'apeller ma fonction teste(), jai une erreur,
Error 1 error LNK2028: unresolved token (0A00000A) "extern "C" int __clrcall test(void)" (?test@@$$J0YMHXZ) referenced in function "private: void __clrcall teste::Form1::abrirToolStripMenuItem_Click(class System::Object ^,class System::EventArgs ^)" (?abrirToolStripMenuItem_Click@Form1@teste@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) teste.obj
si quelqu'un a une idee comment resourdre ce probleme jle remercie.
emmatopiak
Messages postés149Date d'inscriptionmercredi 28 mars 2007StatutMembreDernière intervention17 mai 20072 10 mai 2007 à 20:51
Salut,
Il faudrait coller main.h et le corps de la fonction test aussi parce que tu nous donne juste
#include "main.h"
ca va pas aider beaucoup
Une autruche ne se cuit pas aux petits lardons.
cs_PoLoCh
Messages postés33Date d'inscriptionlundi 28 avril 2003StatutMembreDernière intervention23 août 2008 10 mai 2007 à 21:50
bah le main.c le voila :
#include <stdio.h>
#include <stdlib.h>
#include "main.h"
int test(){
return 1;
}
int main(int argc, char *argv[])
{
return 0;
}
et mon form, c'est la que j'apelle ma fonction :
#pragma once
extern "C" {
// Fournir la déclaration de f(int i, char c, float x)
#include "main.h"
int test();
}
namespace teste {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::MenuStrip^ menuStrip1;
protected:
private: System::Windows::Forms::ToolStripMenuItem^ ficheiroToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ abrirToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ sairToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ sairToolStripMenuItem1;