gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Invalid preprocessing directive #using

#75654 - Nuja - Tue Mar 14, 2006 11:46 pm

Hi,
I a total noob, i'm trying to make my first homebrews but when i try to compile it I get the title of this topic as error. I think its a problem with the dll, but i don't know what.

my code:
Code:

#include "stdafx.h"
#include <PA9.h>
#define TAILLE 1000
#using <C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\mscorlib.dll>

using namespace System;
int _tmain()
{
   PA_Init();
   PA_InitVBL();
   PA_InitText(1,2);
   char mot[TAILLE] = "";
   char ligne[TAILLE] = "";
   char *str = "";
   char res[TAILLE] = "";
   PA_OutputSimpleText(1,1,1,"Veuillez saisir un mot ? traduire en anglais\n");
PA_Init();    // Initializes PA_Lib
PA_InitVBL(); // Initializes a standard VBL
   
PA_InitText(1, 0);  // Initialise the text system
   
PA_InitKeyboard(2); // Load the keyboard on background 2...
   
PA_KeyboardIn(20, 100); // This scrolls the keyboard from the bottom, until it's at the right position
   
PA_OutputSimpleText(1, 7, 10, "Text : ");
   
s32 nletter = 0; // Next letter to right. 0 since no letters are there yet
char letter = 0; // New letter to write.
char text[TAILLE];  // This will be our text.
   
// Infinite loop to keep the program running
while (1)
{
   // We'll check first for color changes, with A, B, and X
   if (Pad.Newpress.A) PA_SetKeyboardColor(0, 1); // Blue and Red
   if (Pad.Newpress.B) PA_SetKeyboardColor(1, 0); // Red and Blue
   if (Pad.Newpress.X) PA_SetKeyboardColor(2, 1); // Green and Red
   if (Pad.Newpress.Y) PA_SetKeyboardColor(0, 2); // Blue and Green
      
   letter = PA_CheckKeyboard();
      
   if (letter > 31) { // there is a new letter
      text[nletter] = letter;
      nletter++;
   }
   else if ((letter == PA_BACKSPACE)&&nletter) { // Backspace pressed
      nletter--;
      text[nletter] = ' '; // Erase the last letter
   }
   else if (letter == '\n'){ // Enter pressed
      text[nletter] = letter;
      nletter++;
   }
      
   mot=text;
   PA_WaitForVBL();
}   

   FILE *fichier = fopen("test.txt", "r");
    if (fichier != NULL) {
      while (!feof(fichier) || str == "") {
        fgets(ligne, TAILLE, fichier);
      strcpy (res, ligne);
      str = strtok(ligne," ");
      if (strcmp(mot, str) == 0) {
         PA_OutputSimpleText(1, 8, 11, res); // Write the text
      //printf("%s\n", res);
      }
      }
      fclose(fichier);
   }
   return 0;
}


Thank in advance
++

#75657 - waruwaru - Wed Mar 15, 2006 12:20 am

Take out this line. Not sure how you got a .net #using in your code....

Code:

#using <C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\mscorlib.dll>


The error message means that the compiler doesn't understand what a #using is...
_________________
DSLua - a scripting language for your DS!

#75658 - tepples - Wed Mar 15, 2006 12:28 am

J++ is not Java, and neither is C# or J#. Likewise, #using is not C++; it's Microsoft Managed C++.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#75700 - Nuja - Wed Mar 15, 2006 9:19 am

If i remove it, i got lot of iostream error. I used visual c++ to make the c++ code then i modified it to make it run with emulator.
here is a screenshot of errors:

http://img227.imageshack.us/img227/8979/compilingerror8lm.jpg

#75704 - sasq - Wed Mar 15, 2006 10:23 am

also take out stdafx.h and anything else that is windows-related (why is your main called _tmain() ? is it required by palib?)

#75723 - tepples - Wed Mar 15, 2006 2:17 pm

Keep it out. Fix most or all iostream errors by
Code:
#include <iostream>
and downloading Chishm's FAT library.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.